<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://hades.mech.northwestern.edu//api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Kwang+Sim</id>
	<title>Mech - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://hades.mech.northwestern.edu//api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Kwang+Sim"/>
	<link rel="alternate" type="text/html" href="https://hades.mech.northwestern.edu//index.php/Special:Contributions/Kwang_Sim"/>
	<updated>2026-04-15T01:49:16Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.35.9</generator>
	<entry>
		<id>https://hades.mech.northwestern.edu//index.php?title=USB_bootloading&amp;diff=13112</id>
		<title>USB bootloading</title>
		<link rel="alternate" type="text/html" href="https://hades.mech.northwestern.edu//index.php?title=USB_bootloading&amp;diff=13112"/>
		<updated>2009-04-21T16:59:54Z</updated>

		<summary type="html">&lt;p&gt;Kwang Sim: by Greg McGlynn&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;#039;&amp;#039;&amp;#039;This article assumes you are using Windows.&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Bootloading allows you to reprogram your PIC without the need for an expensive hardware programmer like an ICD. &lt;br /&gt;
&lt;br /&gt;
Bootloading works like this:&lt;br /&gt;
* You compile your program on the computer, which generates a file with a .hex extension. This is the compiled code for your program, which you want to get onto the PIC. &lt;br /&gt;
* You connect the PIC to the computer, in this case with a simple USB cable. &lt;br /&gt;
* You fire up a PC program that takes your hex file and sends it to the PIC.&lt;br /&gt;
* Sitting on the PIC there is a small program called a bootloader. It takes the hex file that is coming from the computer and writes it into memory. &lt;br /&gt;
* You reset the PIC, and your program starts running!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== USB Bootloading with the PIC 18f4553 ==&lt;br /&gt;
USB bootloading is bootloading over a USB cable. To do this you need to be working with a PIC that talks USB, like an 18f4553. Then you need to have a bootloader on the PIC. The only way to put a bootloader in place is with a hardware programmer like an ICD, but you only need to do this once: afterwards, all you&amp;#039;ll need is a regular USB cable. See [[USB communication with PC|here]] for how to connect a USB cable to a PIC.&lt;br /&gt;
&lt;br /&gt;
=== Loading the bootloader ===&lt;br /&gt;
Here is a USB bootloader hex file that works for the 18f4553 with a 20Mhz oscillator: [[Image:FW_B_20.hex]]. It comes from http://www.schmalzhaus.com/UBW , where you can find the source it was built from, if you&amp;#039;re interested.&lt;br /&gt;
To load this precompiled hex file onto the PIC using the CCS ICD, use the icd.exe program in the C:\Program Files\PICC directory. Now the bootloader is itself loaded.&lt;br /&gt;
&lt;br /&gt;
=== The PC software ===&lt;br /&gt;
There needs to be a program on the PC that sends your hex files to bootloader on the PIC. This bootloader uses a program from the Microchip USB Framework. You can download the framework installer [http://ww1.microchip.com/downloads/en/DeviceDoc/MCHPFSUSB_Setup_v1.3.exe here]. It will create some folders in the C:\ directory. The loader program is at C:\MCHPFSUSB\Pc\Pdfsusb\PDFSUSB.exe.&lt;br /&gt;
&lt;br /&gt;
=== Required circuitry ===&lt;br /&gt;
You need some sort of button or switch hooked up to pin RC2 so that it is normally high. If you reset the PIC and pin RC2 is high, the bootloader will run whatever program you&amp;#039;ve loaded onto it. But if RC2 is low, because you&amp;#039;re pressing the button, the bootloader will run, allowing you to load a new program onto the PIC. You don&amp;#039;t need to keep holding the button down, C2 just has to be low at the time the PIC resets. So whenever you want to put the PIC into bootloader mode, press and hold the reset button, then press your bootloading button, then release the reset button, then release the bootloading button. You can attach an LED to pin RC1 and the bootloader will flash it when it runs. &lt;br /&gt;
&lt;br /&gt;
=== Installing Drivers ===&lt;br /&gt;
When you first connect the PIC to the PC and make the bootloader run, Windows will need to install a driver. Point it to &amp;quot;C:\MCHPFSUSB\Pc\MCHPUSB Driver\Release&amp;quot; and it will install the right driver. Now you&amp;#039;re all set up.&lt;br /&gt;
&lt;br /&gt;
=== Compiling for a bootloader ===&lt;br /&gt;
A bootloader takes up part of the available program memory, and you need to take this into account when you write your program. Generally, the bootloader takes up a small chunk of memory at the beginning of space available for program memory. You need to tell the compiler to place your code just after the bootloader. Our bootloader takes up the memory from 0x000 to 0x7FF (the first two kilobytes of program memory). Your program therefore needs to start at address 0x800 and not touch the memory from 0x000 to 0x7FF. You can accomplish this by adding the following two lines at the top of your code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;#build (reset=0x800, interrupt=0x808)  //code starts right after the bootloader&lt;br /&gt;
#org 0, 0x7FF {}                       //don&amp;#039;t overwrite the bootloader&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Bootloading ===&lt;br /&gt;
Now that everything&amp;#039;s set up, here are the steps to load your program onto your PIC:&lt;br /&gt;
&lt;br /&gt;
* Compile your program with the two lines mentioned above.&lt;br /&gt;
* Fire up PDFSUSB.exe. &lt;br /&gt;
* Put your PIC into bootloading mode. You should now be able to select &amp;quot;PICDEM FS USB 0&amp;quot; from the PDFSUSB.exe drop-down list.&lt;br /&gt;
* Click &amp;quot;Load Hex File&amp;quot; and go find the hex file that you created when you compiled your program.&lt;br /&gt;
* Click &amp;quot;Program Device&amp;quot; to load your program. &lt;br /&gt;
* Reset your PIC and your program should run.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
[[USB communication with PC]]&lt;br /&gt;
&lt;br /&gt;
[[Wireless PIC bootloading]]&lt;/div&gt;</summary>
		<author><name>Kwang Sim</name></author>
	</entry>
	<entry>
		<id>https://hades.mech.northwestern.edu//index.php?title=USB_bootloading&amp;diff=13111</id>
		<title>USB bootloading</title>
		<link rel="alternate" type="text/html" href="https://hades.mech.northwestern.edu//index.php?title=USB_bootloading&amp;diff=13111"/>
		<updated>2009-04-21T16:55:46Z</updated>

		<summary type="html">&lt;p&gt;Kwang Sim: by Greg McGlynn&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;#039;&amp;#039;&amp;#039;This article assumes you are using Windows.&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Bootloading allows you to reprogram your PIC without the need for an expensive hardware programmer like an ICD. &lt;br /&gt;
&lt;br /&gt;
Bootloading works like this:&lt;br /&gt;
* You compile your program on the computer, which generates a file with a .hex extension. This is the compiled code for your program, which you want to get onto the PIC. &lt;br /&gt;
* You connect the PIC to the computer, in this case with a simple USB cable. &lt;br /&gt;
* You fire up a PC program that takes your hex file and sends it to the PIC.&lt;br /&gt;
* Sitting on the PIC there is a small program called a bootloader. It takes the hex file that is coming from the computer and writes it into memory. &lt;br /&gt;
* You reset the PIC, and your program starts running!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== USB Bootloading with the PIC 18f4553 ==&lt;br /&gt;
USB bootloading is bootloading over a USB cable. To do this you need to be working with a PIC that talks USB, like an 18f4553. Then you need to have a bootloader on the PIC. The only way to put a bootloader in place is with a hardware programmer like an ICD, but you only need to do this once: afterwards, all you&amp;#039;ll need is a regular USB cable. See [[USB communication with PC|here]] for how to connect a USB cable to a PIC.&lt;br /&gt;
&lt;br /&gt;
=== Loading the bootloader ===&lt;br /&gt;
Here is a USB bootloader hex file that works for the 18f4553 with a 20Mhz oscillator: [[Image:FW_B_20.hex]]. It comes from http://www.schmalzhaus.com/UBW , where you can find the source it was built from, if you&amp;#039;re interested.&lt;br /&gt;
To load this precompiled hex file onto the PIC using the CCS ICD, use the icd.exe program in the C:\Program Files\PICC directory. Now the bootloader is itself loaded.&lt;br /&gt;
&lt;br /&gt;
=== The PC software ===&lt;br /&gt;
There needs to be a program on the PC that sends your hex files to bootloader on the PIC. This bootloader uses a program from the Microchip USB Framework. You can download the framework installer [http://ww1.microchip.com/downloads/en/DeviceDoc/MCHPFSUSB_Setup_v1.3.exe here]. It will create some folders in the C:\ directory. The loader program is at C:\MCHPFSUSB\Pc\Pdfsusb\PDFSUSB.exe.&lt;br /&gt;
&lt;br /&gt;
=== Required circuitry ===&lt;br /&gt;
You need some sort of button or switch hooked up to pin RC2 so that it is normally high. If you reset the PIC and pin RC2 is high, the bootloader will run whatever program you&amp;#039;ve loaded onto it. But if RC2 is low, because you&amp;#039;re pressing the button, the bootloader will run, allowing you to load a new program onto the PIC. You don&amp;#039;t need to keep holding the button down, C2 just has to be low at the time the PIC resets. So whenever you want to put the PIC into bootloader mode, press and hold the reset button, then press your bootloading button, then release the reset button, then release the bootloading button. You can attach an LED to pin RC1 and the bootloader will flash it when it runs. &lt;br /&gt;
&lt;br /&gt;
=== Installing Drivers ===&lt;br /&gt;
When you first connect the PIC to the PC and make the bootloader run, Windows will need to install a driver. Point it to &amp;quot;C:\MCHPFSUSB\Pc\MCHPUSB Driver\Release&amp;quot; and it will install the right driver. Now you&amp;#039;re all set up.&lt;br /&gt;
&lt;br /&gt;
=== Compiling for a bootloader ===&lt;br /&gt;
A bootloader takes up part of the available program memory, and you need to take this into account when you write your program. Generally, the bootloader takes up a small chunk of memory at the beginning of space available for program memory. You need to tell the compiler to place your code just after the bootloader. Our bootloader takes up the memory from 0x000 to 0x7FF (the first two kilobytes of program memory). Your program therefore needs to start at address 0x800 and not touch the memory from 0x000 to 0x7FF. You can accomplish this by adding the following two lines at the top of your code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;#build (reset=0x800, interrupt=0x808)  //code starts right after the bootloader&lt;br /&gt;
#org 0, 0x7FF {}                       //don&amp;#039;t overwrite the bootloader&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Bootloading ===&lt;br /&gt;
Now that everything&amp;#039;s set up, here are the steps to load your program onto your PIC:&lt;br /&gt;
&lt;br /&gt;
* Compile your program with the two lines mentioned above.&lt;br /&gt;
* Fire up PDFSUSB.exe. &lt;br /&gt;
* Put your PIC into bootloading mode. You should now be able to select &amp;quot;PIC DEM FS 0&amp;quot; from the PDFSUSB.exe drop-down list.&lt;br /&gt;
* Click &amp;quot;Load Hex File&amp;quot; and go find the hex file that you created when you compiled your program.&lt;br /&gt;
* Click &amp;quot;Program Device&amp;quot; to load your program. &lt;br /&gt;
* Reset your PIC and your program should run.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
[[USB communication with PC]]&lt;br /&gt;
&lt;br /&gt;
[[Wireless PIC bootloading]]&lt;/div&gt;</summary>
		<author><name>Kwang Sim</name></author>
	</entry>
	<entry>
		<id>https://hades.mech.northwestern.edu//index.php?title=USB_communication_with_PC&amp;diff=13110</id>
		<title>USB communication with PC</title>
		<link rel="alternate" type="text/html" href="https://hades.mech.northwestern.edu//index.php?title=USB_communication_with_PC&amp;diff=13110"/>
		<updated>2009-04-21T16:52:00Z</updated>

		<summary type="html">&lt;p&gt;Kwang Sim: by Greg McGlynn&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Some PIC models have built-in USB transceivers that make it simple to connect the PIC to a computer via USB. One such PIC is the 18f4553, which is similar to the 18f4520 in almost all respects, except that it has hardware support for USB built into it. The 18f4553 will work just fine in one of the [[4520_Board_intro|PIC protoboards]]. &lt;br /&gt;
&lt;br /&gt;
I&amp;#039;m not clear on how cross-platform USB software tends to be. &amp;#039;&amp;#039;&amp;#039;This article currently assumes you&amp;#039;re running Windows.&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
== The USB protocol ==&lt;br /&gt;
USB is a pretty complex protocol with a long specification, but it&amp;#039;s not necessary to understand every part of it to use it. It&amp;#039;s enough to know what wires to hook up and what software libraries to include in your code, and using USB will be easy. &lt;br /&gt;
&lt;br /&gt;
Wikipedia has a detailed and informative [http://en.wikipedia.org/wiki/Usb page on USB]. &lt;br /&gt;
&lt;br /&gt;
USB connectors have four leads; the pictures on Wikipedia show which is which on standard connectors.&lt;br /&gt;
* +5V: the host [computer] provides up to 500mA of current at 5V that you can use for power. If your PIC is self-powered, though, make sure you don&amp;#039;t connect the two +5V sources or bad things may happen.&lt;br /&gt;
* GND: ground; make sure you do connect this to your PIC&amp;#039;s ground.&lt;br /&gt;
* D+ and D-: data is transmitted on these lines. The exact protocol is complicated and you probably don&amp;#039;t need to know the details.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== USB with the PIC 18F4553 ==&lt;br /&gt;
=== Hardware ===&lt;br /&gt;
On the 18f4553, the D+ line connects to pin RC5 and the D- line to pin RC4. The ground line of course connects to ground.&lt;br /&gt;
&lt;br /&gt;
Additionally pin 18, called Vusb, should have a capacitor to ground. Try 220 or 470nF.&lt;br /&gt;
&lt;br /&gt;
=== Software ===&lt;br /&gt;
On the software side you have some choices. Probably the simplest thing to do is use a preexisting software library that makes the USB connection look like an [[PIC RS232|RS232 connection]]. The CCS compiler has a CDC library that provides functions like usb_cdc_getc or usb_cdc_putc that work over USB exactly like regular getc and putc work over RS232. CCS also provides a Windows driver for the PC that creates a virtual COM port that you can open in Matlab or Hyperterminal and use to talk to the PIC.&lt;br /&gt;
&lt;br /&gt;
A sample program using CCS&amp;#039;s CDC library is shown below. The program waits for some input and then responds to it. When you first plug in the PIC to the computer, Windows will need to install a driver to talk to it. If you&amp;#039;re running XP or earlier, point it to the directory C:\Program Files\PICC\Drivers, where it will find what it needs. If you&amp;#039;re running Vista the driver may not be there; download [[Image:Cdc_NTXPVista.inf]], save it somewhere, and point Windows to it. Once the driver is installed a virtual COM port will be created (it will be visible in the device manager) and you&amp;#039;ll be able to talk to the PIC in Hyperterminal, Matlab, or anything else that communications over RS232.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;#include &amp;lt;18f4550.h&amp;gt; //if your version of the compiler doesn&amp;#039;t support the 4553, you can put the 4550 in your code, which is almost exactly the same.&lt;br /&gt;
#use delay(clock=48000000) //because of tricky fuses a 20Mhz oscillator will make the PIC run at 48Mhz&lt;br /&gt;
#fuses HS, NOWDT, NOLVP, NOPROTECT //standard fuses&lt;br /&gt;
&lt;br /&gt;
//these fuses are critical. they assume a 20Mhz oscillator:&lt;br /&gt;
#fuses PLL5     //The USB module must run at 48Mhz. This tells the PIC to take the oscillator, divide the frequency by 5, then multiply by 12. The result must be 48Mhz. &lt;br /&gt;
#fuses HSPLL    //I&amp;#039;m not exactly sure what this fuses does, but it&amp;#039;s probably necessary.&lt;br /&gt;
#fuses VREGEN   //The USB module must run at 3.3V. This tells the PIC to accomplish this by using an internal voltage regulator.&lt;br /&gt;
#fuses CPUDIV1  //This tells the PIC to run at a frequency of 48Mhz / 1 = 48Mhz. It may or may not be necessary.&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt;usb_cdc.h&amp;gt; //Include the CCS USB library. If you want to see all the functions available look at usb_cdc.h and usb.h.&lt;br /&gt;
&lt;br /&gt;
void main() {&lt;br /&gt;
   int c;&lt;br /&gt;
&lt;br /&gt;
   //these lines do some initialization, obviously:&lt;br /&gt;
   usb_cdc_init();&lt;br /&gt;
   usb_init();&lt;br /&gt;
   usb_wait_for_enumeration();   &lt;br /&gt;
&lt;br /&gt;
   while(true) {&lt;br /&gt;
       usb_task(); //handles connections to and disconnections from the computer, registering the PIC with the computer, etc. call this pretty often so that the PIC responds to being plugged in. &lt;br /&gt;
       &lt;br /&gt;
       if(usb_cdc_kbhit()) { //did we get some incoming data? &lt;br /&gt;
           c = usb_cdc_getc(); //get one character of input&lt;br /&gt;
           printf(usb_cdc_putc, &amp;quot;you typed: %c\r\n&amp;quot;, c); //print out a response over usb&lt;br /&gt;
       }&lt;br /&gt;
   }&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
CCS also has an example where the PIC registers itself as a Human Interface Device (HID). USB mice and keyboards use HID. The advantage of this is that doesn&amp;#039;t require the user to install a special driver. The disadvantages are (a) the connection doesn&amp;#039;t look like a simple RS232 link and (b) bandwidth is limited. A HID can only send messages to the computer once every millisecond, and can only send 64 bytes in each message, so the maximum data transfer rate is 64K bytes/second. In theory, USB can go up to 12M bits/second, so HID is fairly slow in comparison. &lt;br /&gt;
&lt;br /&gt;
Microchip provides a USB framework for use with its [[PIC Microcontrollers with C18 Compiler|C18 compiler]]. &lt;br /&gt;
&lt;br /&gt;
It&amp;#039;s also possible to create one&amp;#039;s own setup from scratch or by modifying a preexisting library. This probably takes some effort.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
[[USB Bootloading]]&lt;/div&gt;</summary>
		<author><name>Kwang Sim</name></author>
	</entry>
	<entry>
		<id>https://hades.mech.northwestern.edu//index.php?title=USB_communication_with_PC&amp;diff=13109</id>
		<title>USB communication with PC</title>
		<link rel="alternate" type="text/html" href="https://hades.mech.northwestern.edu//index.php?title=USB_communication_with_PC&amp;diff=13109"/>
		<updated>2009-04-21T16:37:29Z</updated>

		<summary type="html">&lt;p&gt;Kwang Sim: by Greg McGlynn&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Some PIC models have built-in USB transceivers that make it simple to connect the PIC to a computer via USB. One such PIC is the 18f4553, which is similar to the 18f4520 in almost all respects, except that it has hardware support for USB built into it. The 18f4553 will work just fine in one of the [[4520_Board_intro|PIC protoboards]]. &lt;br /&gt;
&lt;br /&gt;
I&amp;#039;m not clear on how cross-platform USB software tends to be. &amp;#039;&amp;#039;&amp;#039;This article currently assumes you&amp;#039;re running Windows.&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
== The USB protocol ==&lt;br /&gt;
USB is a pretty complex protocol with a long specification, but it&amp;#039;s not necessary to understand every part of it to use it. It&amp;#039;s enough to know what wires to hook up and what software libraries to include in your code, and using USB will be easy. &lt;br /&gt;
&lt;br /&gt;
Wikipedia has a detailed and informative [http://en.wikipedia.org/wiki/Usb page on USB]. &lt;br /&gt;
&lt;br /&gt;
USB connectors have four leads; the pictures on Wikipedia show which is which on standard connectors.&lt;br /&gt;
* +5V: the host [computer] provides up to 500mA of current at 5V that you can use for power. If your PIC is self-powered, though, make sure you don&amp;#039;t connect the two +5V sources or bad things may happen.&lt;br /&gt;
* GND: ground; make sure you do connect this to your PIC&amp;#039;s ground.&lt;br /&gt;
* D+ and D-: data is transmitted on these lines. The exact protocol is complicated and you probably don&amp;#039;t need to know the details.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== USB with the PIC 18F4553 ==&lt;br /&gt;
=== Hardware ===&lt;br /&gt;
On the 18f4553, the D+ line connects to pin RC5 and the D- line to pin RC4. The ground line of course connects to ground.&lt;br /&gt;
&lt;br /&gt;
Additionally pin 18, called Vusb, should have a capacitor to ground. Try 220 or 470nF.&lt;br /&gt;
&lt;br /&gt;
=== Software ===&lt;br /&gt;
On the software side you have some choices. Probably the simplest thing to do is use a preexisting software library that makes the USB connection look like an [[PIC RS232|RS232 connection]]. The CCS compiler has a CDC library that provides functions like usb_cdc_getc or usb_cdc_putc that work over USB exactly like regular getc and putc work over RS232. CCS also provides a Windows driver for the PC that creates a virtual COM port that you can open in Matlab or Hyperterminal and use to talk to the PIC.&lt;br /&gt;
&lt;br /&gt;
A sample program using CCS&amp;#039;s CDC library is shown below. The program waits for some input and then responds to it. When you first plug in the PIC to the computer, Windows will need to install a driver to talk to it. If you&amp;#039;re running XP or earlier, point it to the directory C:\Program Files\PICC\Drivers, where it will find what it needs. If you&amp;#039;re running Vista the driver may not be there; download [[Image:Cdc_NTXPVista.inf]], save it somewhere, and point Windows to it. Once the driver is installed a virtual COM port will be created (it will be visible in the device manager) and you&amp;#039;ll be able to talk to the PIC in Hyperterminal, Matlab, or anything else that communications over RS232.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;#include &amp;lt;18f4550.h&amp;gt; //if your version of the compiler doesn&amp;#039;t support the 4553, you can put the 4550 in your code, which is almost exactly the same.&lt;br /&gt;
#use delay(clock=48000000) //because of tricky fuses a 20Mhz oscillator will make the PIC run at 48Mhz&lt;br /&gt;
#fuses HS, NOWDT, NOLVP, NOPROTECT //standard fuses&lt;br /&gt;
&lt;br /&gt;
//these fuses are critical. they assume a 20Mhz oscillator:&lt;br /&gt;
#fuses PLL5     //The USB module must run at 48Mhz. This tells the PIC to take the oscillator, divide the frequency by 5, then multiply by 12. The result must be 48Mhz. &lt;br /&gt;
#fuses HSPLL    //I&amp;#039;m not exactly sure what this fuses does, but it&amp;#039;s probably necessary.&lt;br /&gt;
#fuses VREGEN   //The USB module must run at 3.3V. This tells the PIC to accomplish this by using an internal voltage regulator.&lt;br /&gt;
#fuses CPUDIV1  //This tells the PIC to run at a frequency of 48Mhz / 1 = 48Mhz. It may or may not be necessary.&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt;usb_cdc.h&amp;gt; //Include the CCS USB library. If you want to see all the functions available look at usb_cdc.h and usb.h.&lt;br /&gt;
&lt;br /&gt;
void main() {&lt;br /&gt;
   int c;&lt;br /&gt;
&lt;br /&gt;
   //these lines do some initialization, obviously:&lt;br /&gt;
   usb_cdc_init();&lt;br /&gt;
   usb_init();&lt;br /&gt;
&lt;br /&gt;
   while(true) {&lt;br /&gt;
       usb_task(); //handles connections to and disconnections from the computer, registering the PIC with the computer, etc. call this pretty often so that the PIC responds to being plugged in. &lt;br /&gt;
       &lt;br /&gt;
       if(usb_cdc_kbhit()) { //did we get some incoming data? &lt;br /&gt;
           c = usb_cdc_getc(); //get one character of input&lt;br /&gt;
           printf(usb_cdc_putc, &amp;quot;you typed: %c\r\n&amp;quot;, c); //print out a response over usb&lt;br /&gt;
       }&lt;br /&gt;
   }&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
CCS also has an example where the PIC registers itself as a Human Interface Device (HID). USB mice and keyboards use HID. The advantage of this is that doesn&amp;#039;t require the user to install a special driver. The disadvantages are (a) the connection doesn&amp;#039;t look like a simple RS232 link and (b) bandwidth is limited. A HID can only send messages to the computer once every millisecond, and can only send 64 bytes in each message, so the maximum data transfer rate is 64K bytes/second. In theory, USB can go up to 12M bits/second, so HID is fairly slow in comparison. &lt;br /&gt;
&lt;br /&gt;
Microchip provides a USB framework for use with its [[PIC Microcontrollers with C18 Compiler|C18 compiler]]. &lt;br /&gt;
&lt;br /&gt;
It&amp;#039;s also possible to create one&amp;#039;s own setup from scratch or by modifying a preexisting library. This probably takes some effort.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
[[USB Bootloading]]&lt;/div&gt;</summary>
		<author><name>Kwang Sim</name></author>
	</entry>
	<entry>
		<id>https://hades.mech.northwestern.edu//index.php?title=USB_bootloading&amp;diff=13072</id>
		<title>USB bootloading</title>
		<link rel="alternate" type="text/html" href="https://hades.mech.northwestern.edu//index.php?title=USB_bootloading&amp;diff=13072"/>
		<updated>2009-04-20T22:49:23Z</updated>

		<summary type="html">&lt;p&gt;Kwang Sim: by Greg McGlynn&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;#039;&amp;#039;&amp;#039;This article assumes you are using Windows.&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Bootloading allows you to reprogram your PIC without the need for an expensive hardware programmer like an ICD. &lt;br /&gt;
&lt;br /&gt;
Bootloading works like this:&lt;br /&gt;
* You compile your program on the computer, which generates a file with a .hex extension. This is the compiled code for your program, which you want to get onto the PIC. &lt;br /&gt;
* You connect the PIC to the computer, in this case with a simple USB cable. &lt;br /&gt;
* You fire up a PC program that takes your hex file and sends it to the PIC.&lt;br /&gt;
* Sitting on the PIC there is a small program called a bootloader. It takes the hex file that is coming from the computer and writes it into memory. &lt;br /&gt;
* You reset the PIC, and your program starts running!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== USB Bootloading with the PIC 18f4553 ==&lt;br /&gt;
USB bootloading is bootloading over a USB cable. To do this you need to be working with a PIC that talks USB, like an 18f4553. Then you need to have a bootloader on the PIC. The only way to put a bootloader in place is with a hardware programmer like an ICD, but you only need to do this once: afterwards, all you&amp;#039;ll need is a regular USB cable. See [[USB communication with PC|here]] for how to connect a USB cable to a PIC.&lt;br /&gt;
&lt;br /&gt;
=== Loading the bootloader ===&lt;br /&gt;
Here is a USB bootloader hex file that works for the 18f4553 with a 20Mhz oscillator: [[Image:FW_B_20.hex]]. It comes from http://www.schmalzhaus.com/UBW , where you can find the source it was built from, if you&amp;#039;re interested.&lt;br /&gt;
To load this precompiled hex file onto the PIC using the CCS ICD, use the icd.exe program in the C:\Program Files\PICC directory. Now the bootloader is itself loaded.&lt;br /&gt;
&lt;br /&gt;
=== The PC software ===&lt;br /&gt;
There needs to be a program on the PC that sends your hex files to bootloader on the PIC. This bootloader uses a program from the Microchip USB Framework. You can download the framework installer [http://ww1.microchip.com/downloads/en/DeviceDoc/MCHPFSUSB_Setup_v1.3.exe here]. It will create some folders in the C:\ directory. The loader program is at (some location).&lt;br /&gt;
&lt;br /&gt;
=== Required circuitry ===&lt;br /&gt;
You need some sort of button or switch hooked up to pin RC2 so that it is normally high. If you reset the PIC and pin RC2 is high, the bootloader will run whatever program you&amp;#039;ve loaded onto it. But if RC2 is low, because you&amp;#039;re pressing the button, the bootloader will run, allowing you to load a new program onto the PIC. You don&amp;#039;t need to keep holding the button down, C2 just has to be low at the time the PIC resets. So whenever you want to put the PIC into bootloader mode, press and hold the reset button, then press your bootloading button, then release the reset button, then release the bootloading button. You can attach an LED to pin RC1 and the bootloader will flash it when it runs. &lt;br /&gt;
&lt;br /&gt;
=== Installing Drivers ===&lt;br /&gt;
When you first connect the PIC to the PC and make the bootloader run, Windows will need to install a driver. Point it to (some location) and it will install the right driver. Now you&amp;#039;re all set up.&lt;br /&gt;
&lt;br /&gt;
=== Compiling for a bootloader ===&lt;br /&gt;
A bootloader takes up part of the available program memory, and you need to take this into account when you write your program. Generally, the bootloader takes up a small chunk of memory at the beginning of space available for program memory. You need to tell the compiler to place your code just after the bootloader. Our bootloader takes up the memory from 0x000 to 0x7FF (the first two kilobytes of program memory). Your program therefore needs to start at address 0x800 and not touch the memory from 0x000 to 0x7FF. You can accomplish this by adding the following two lines at the top of your code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;#build (reset=0x800, interrupt=0x808)  //code starts right after the bootloader&lt;br /&gt;
#org 0, 0x7FF {}                       //don&amp;#039;t overwrite the bootloader&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Bootloading ===&lt;br /&gt;
Now that everything&amp;#039;s set up, here are the steps to load your program onto your PIC:&lt;br /&gt;
&lt;br /&gt;
* Compile your program with the two lines mentioned above.&lt;br /&gt;
* Fire up (some location).exe. &lt;br /&gt;
* Put your PIC into bootloading mode. You should now be able to select (some string) from the (some string).exe drop-down list.&lt;br /&gt;
* Click &amp;quot;Load Hex File&amp;quot; and go find the hex file that you created when you compiled your program.&lt;br /&gt;
* Click &amp;quot;Program Device&amp;quot; to load your program. &lt;br /&gt;
* Reset your PIC and your program should run.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
[[USB communication with PC]]&lt;br /&gt;
&lt;br /&gt;
[[Wireless PIC bootloading]]&lt;/div&gt;</summary>
		<author><name>Kwang Sim</name></author>
	</entry>
	<entry>
		<id>https://hades.mech.northwestern.edu//index.php?title=USB_bootloading&amp;diff=13071</id>
		<title>USB bootloading</title>
		<link rel="alternate" type="text/html" href="https://hades.mech.northwestern.edu//index.php?title=USB_bootloading&amp;diff=13071"/>
		<updated>2009-04-20T22:46:16Z</updated>

		<summary type="html">&lt;p&gt;Kwang Sim: by Greg McGlynn&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;#039;&amp;#039;&amp;#039;This article assumes you are using Windows.&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Bootloading allows you to reprogram your PIC without the need for an expensive hardware programmer like an ICD. &lt;br /&gt;
&lt;br /&gt;
Bootloading works like this:&lt;br /&gt;
* You compile your program on the computer, which generates a file with a .hex extension. This is the compiled code for your program, which you want to get onto the PIC. &lt;br /&gt;
* You connect the PIC to the computer, in this case with a simple USB cable. &lt;br /&gt;
* You fire up a PC program that takes your hex file and sends it to the PIC.&lt;br /&gt;
* Sitting on the PIC there is a small program called a bootloader. It takes the hex file that is coming from the computer and writes it into memory. &lt;br /&gt;
* You reset the PIC, and your program starts running!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== USB Bootloading with the PIC 18f4553 ==&lt;br /&gt;
USB bootloading is bootloading over a USB cable. To do this you need to be working with a PIC that talks USB, like an 18f4553. Then you need to have a bootloader on the PIC. The only way to put a bootloader in place is with a hardware programmer like an ICD, but you only need to do this once: afterwards, all you&amp;#039;ll need is a regular USB cable. See [[USB communication with PC|here]] for how to connect a USB cable to a PIC.&lt;br /&gt;
&lt;br /&gt;
=== Loading the bootloader ===&lt;br /&gt;
Here is a USB bootloader hex file that works for the 18f4553 with a 20Mhz oscillator: [[Image:FW_B_20.hex]]. It comes from http://www.schmalzhaus.com/UBW , where you can find the source it was built from, if you&amp;#039;re interested.&lt;br /&gt;
To load this precompiled hex file onto the PIC using the CCS ICD, use the icd.exe program in the C:\Program Files\PICC directory. Now the bootloader is itself loaded.&lt;br /&gt;
&lt;br /&gt;
=== The PC software ===&lt;br /&gt;
There needs to be a program on the PC that sends your hex files to bootloader on the PIC. This bootloader uses a program from the Microchip USB Framework. You can download the framework installer [http://ww1.microchip.com/downloads/en/DeviceDoc/MCHPFSUSB_Setup_v1.3.exe here]. It will create some folders in the C:\ directory. The loader program is at (some location).&lt;br /&gt;
&lt;br /&gt;
=== Required circuitry ===&lt;br /&gt;
You need some sort of button or switch hooked up to pin RC2 so that it is normally high. If you reset the PIC and pin RC2 is high, the bootloader will run whatever program you&amp;#039;ve loaded onto it. But if RC2 is low, because you&amp;#039;re pressing the button, the bootloader will run, allowing you to load a new program onto the PIC. You don&amp;#039;t need to keep holding the button down, C2 just has to be low at the time the PIC resets. So whenever you want to put the PIC into bootloader mode, press and hold the reset button, then press your bootloading button, then release the reset button, then release the bootloading button. You can attach an LED to pin RC1 and the bootloader will flash it when it runs. &lt;br /&gt;
&lt;br /&gt;
=== Installing Drivers ===&lt;br /&gt;
When you first connect the PIC to the PC and make the bootloader run, Windows will need to install a driver. Point it to (some location) and it will install the right driver. Now you&amp;#039;re all set up.&lt;br /&gt;
&lt;br /&gt;
=== Compiling for a bootloader ===&lt;br /&gt;
A bootloader takes up part of the available program memory, and you need to take this into account when you write your program. Generally, the bootloader takes up a small chunk of memory at the beginning of space available for program memory. You need to tell the compiler to place your code just after the bootloader. Our bootloader takes up the memory from 0x000 to 0x7FF (the first two kilobytes of program memory). Your program therefore needs to start at address 0x800 and not touch the memory from 0x000 to 0x7FF. You can do this by adding the following two lines at the top of your code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;#build (reset=0x800, interrupt=0x808)  //code starts right after the bootloader&lt;br /&gt;
#org 0, 0x7FF {}                       //don&amp;#039;t overwrite the bootloader&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Bootloading ===&lt;br /&gt;
So you&amp;#039;ve compiled your program and want to load it on to your PIC. Fire up (some location).exe. Put your PIC into bootloading mode. You should now be able to select (some string) from the (some string).exe drop-down list. Now click &amp;quot;Load Hex File&amp;quot; and go find the hex file that you created when you compiled your program. Then click &amp;quot;Program Device&amp;quot; to load your program. Reset your PIC and your program should run.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
[[USB communication with PC]]&lt;br /&gt;
[[Wireless PIC bootloading]]&lt;/div&gt;</summary>
		<author><name>Kwang Sim</name></author>
	</entry>
	<entry>
		<id>https://hades.mech.northwestern.edu//index.php?title=USB_bootloading&amp;diff=13070</id>
		<title>USB bootloading</title>
		<link rel="alternate" type="text/html" href="https://hades.mech.northwestern.edu//index.php?title=USB_bootloading&amp;diff=13070"/>
		<updated>2009-04-20T22:45:51Z</updated>

		<summary type="html">&lt;p&gt;Kwang Sim: by Greg McGlynn&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;#039;&amp;#039;&amp;#039;This article assumes you are using Windows.&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Bootloading allows you to reprogram your PIC without the need for an expensive hardware programmer like an ICD. &lt;br /&gt;
&lt;br /&gt;
Bootloading works like this:&lt;br /&gt;
* You compile your program on the computer, which generates a file with a .hex extension. This is the compiled code for your program, which you want to get onto the PIC. &lt;br /&gt;
* You connect the PIC to the computer, in this case with a simple USB cable. &lt;br /&gt;
* You fire up a PC program that takes your hex file and sends it to the PIC.&lt;br /&gt;
* Sitting on the PIC there is a small program called a bootloader. It takes the hex file that is coming from the computer and writes it into memory. &lt;br /&gt;
* You reset the PIC, and your program starts running!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== USB Bootloading with the PIC 18f4553 ==&lt;br /&gt;
USB bootloading is bootloading over a USB cable. To do this you need to be working with a PIC that talks USB, like an 18f4553. Then you need to have a bootloader on the PIC. The only way to put a bootloader in place is with a hardware programmer like an ICD, but you only need to do this once: afterwards, all you&amp;#039;ll need is a regular USB cable. See [[USB communication with PC|here]] for how to connect a USB cable to a PIC.&lt;br /&gt;
&lt;br /&gt;
=== Loading the bootloader ===&lt;br /&gt;
Here is a USB bootloader hex file that works for the 18f4553 with a 20Mhz oscillator: [[FW_B_20.hex]]. It comes from http://www.schmalzhaus.com/UBW , where you can find the source it was built from, if you&amp;#039;re interested.&lt;br /&gt;
To load this precompiled hex file onto the PIC using the CCS ICD, use the icd.exe program in the C:\Program Files\PICC directory. Now the bootloader is itself loaded.&lt;br /&gt;
&lt;br /&gt;
=== The PC software ===&lt;br /&gt;
There needs to be a program on the PC that sends your hex files to bootloader on the PIC. This bootloader uses a program from the Microchip USB Framework. You can download the framework installer [http://ww1.microchip.com/downloads/en/DeviceDoc/MCHPFSUSB_Setup_v1.3.exe here]. It will create some folders in the C:\ directory. The loader program is at (some location).&lt;br /&gt;
&lt;br /&gt;
=== Required circuitry ===&lt;br /&gt;
You need some sort of button or switch hooked up to pin RC2 so that it is normally high. If you reset the PIC and pin RC2 is high, the bootloader will run whatever program you&amp;#039;ve loaded onto it. But if RC2 is low, because you&amp;#039;re pressing the button, the bootloader will run, allowing you to load a new program onto the PIC. You don&amp;#039;t need to keep holding the button down, C2 just has to be low at the time the PIC resets. So whenever you want to put the PIC into bootloader mode, press and hold the reset button, then press your bootloading button, then release the reset button, then release the bootloading button. You can attach an LED to pin RC1 and the bootloader will flash it when it runs. &lt;br /&gt;
&lt;br /&gt;
=== Installing Drivers ===&lt;br /&gt;
When you first connect the PIC to the PC and make the bootloader run, Windows will need to install a driver. Point it to (some location) and it will install the right driver. Now you&amp;#039;re all set up.&lt;br /&gt;
&lt;br /&gt;
=== Compiling for a bootloader ===&lt;br /&gt;
A bootloader takes up part of the available program memory, and you need to take this into account when you write your program. Generally, the bootloader takes up a small chunk of memory at the beginning of space available for program memory. You need to tell the compiler to place your code just after the bootloader. Our bootloader takes up the memory from 0x000 to 0x7FF (the first two kilobytes of program memory). Your program therefore needs to start at address 0x800 and not touch the memory from 0x000 to 0x7FF. You can do this by adding the following two lines at the top of your code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;#build (reset=0x800, interrupt=0x808)  //code starts right after the bootloader&lt;br /&gt;
#org 0, 0x7FF {}                       //don&amp;#039;t overwrite the bootloader&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Bootloading ===&lt;br /&gt;
So you&amp;#039;ve compiled your program and want to load it on to your PIC. Fire up (some location).exe. Put your PIC into bootloading mode. You should now be able to select (some string) from the (some string).exe drop-down list. Now click &amp;quot;Load Hex File&amp;quot; and go find the hex file that you created when you compiled your program. Then click &amp;quot;Program Device&amp;quot; to load your program. Reset your PIC and your program should run.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
[[USB communication with PC]]&lt;br /&gt;
[[Wireless PIC bootloading]]&lt;/div&gt;</summary>
		<author><name>Kwang Sim</name></author>
	</entry>
	<entry>
		<id>https://hades.mech.northwestern.edu//index.php?title=USB_bootloading&amp;diff=13069</id>
		<title>USB bootloading</title>
		<link rel="alternate" type="text/html" href="https://hades.mech.northwestern.edu//index.php?title=USB_bootloading&amp;diff=13069"/>
		<updated>2009-04-20T22:45:05Z</updated>

		<summary type="html">&lt;p&gt;Kwang Sim: by Greg McGlynn&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;#039;&amp;#039;&amp;#039;This article assumes you are using Windows.&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Bootloading allows you to reprogram your PIC without the need for an expensive hardware programmer like an ICD. &lt;br /&gt;
&lt;br /&gt;
Bootloading works like this:&lt;br /&gt;
* You compile your program on the computer, which generates a file with a .hex extension. This is the compiled code for your program, which you want to get onto the PIC. &lt;br /&gt;
* You connect the PIC to the computer, in this case with a simple USB cable. &lt;br /&gt;
* You fire up a PC program that takes your hex file and sends it to the PIC.&lt;br /&gt;
* Sitting on the PIC there is a small program called a bootloader. It takes the hex file that is coming from the computer and writes it into memory. &lt;br /&gt;
* You reset the PIC, and your program starts running!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== USB Bootloading with the PIC 18f4553 ==&lt;br /&gt;
USB bootloading is bootloading over a USB cable. To do this you need to be working with a PIC that talks USB, like an 18f4553. Then you need to have a bootloader on the PIC. The only way to put a bootloader in place is with a hardware programmer like an ICD, but you only need to do this once: afterwards, all you&amp;#039;ll need is a regular USB cable. See [[USB communication with PC|here]] for how to connect a USB cable to a PIC.&lt;br /&gt;
&lt;br /&gt;
=== Loading the bootloader ===&lt;br /&gt;
Here is a USB bootloader hex file that works for the 18f4553 with a 20Mhz oscillator: [[FW_B_20.hex]]. It comes from http://www.schmalzhaus.com/UBW , where you can find the source it was built from, if you&amp;#039;re interested.&lt;br /&gt;
To load this precompiled hex file onto the PIC using the CCS ICD, use the icd.exe program in the C:\Program Files\PICC directory. Now the bootloader is itself loaded.&lt;br /&gt;
&lt;br /&gt;
=== The PC software ===&lt;br /&gt;
There needs to be a program on the PC that sends your hex files to bootloader on the PIC. This bootloader uses a program from the Microchip USB Framework. You can download the framework installer [http://ww1.microchip.com/downloads/en/DeviceDoc/MCHPFSUSB_Setup_v1.3.exe here]. It will create some folders in the C:\ directory. The loader program is at (some location).&lt;br /&gt;
&lt;br /&gt;
=== Required circuitry ===&lt;br /&gt;
You need some sort of button or switch hooked up to pin RC2 so that it is normally high. If you reset the PIC and pin RC2 is high, the bootloader will run whatever program you&amp;#039;ve loaded onto it. But if RC2 is low, because you&amp;#039;re pressing the button, the bootloader will run, allowing you to load a new program onto the PIC. You don&amp;#039;t need to keep holding the button down, C2 just has to be low at the time the PIC resets. So whenever you want to put the PIC into bootloader mode, press and hold the reset button, then press your bootloading button, then release the reset button, then release the bootloading button. You can attach an LED to pin RC1 and the bootloader will flash it when it runs. &lt;br /&gt;
&lt;br /&gt;
=== Installing Drivers ===&lt;br /&gt;
When you first connect the PIC to the PC and make the bootloader run, Windows will need to install a driver. Point it to (some location) and it will install the right driver. Now you&amp;#039;re all set up.&lt;br /&gt;
&lt;br /&gt;
=== Compiling for a bootloader ===&lt;br /&gt;
A bootloader takes up part of the available program memory, and you need to take this into account when you write your program. Generally, the bootloader takes up a small chunk of memory at the beginning of space available for program memory. You need to tell the compiler to place your code just after the bootloader. Our bootloader takes up the memory from 0x000 to 0x7FF (the first two kilobytes of program memory). Your program therefore needs to start at address 0x800 and not touch the memory from 0x000 to 0x7FF. You can do this by adding the following two lines at the top of your code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;#build (reset=0x800, interrupt=0x808)  //code starts right after the bootloader&lt;br /&gt;
#org 0, 0x7FF {}                       //don&amp;#039;t overwrite the bootloader&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Bootloading ===&lt;br /&gt;
So you&amp;#039;ve compiled your program and want to load it on to your PIC. Fire up (some location).exe. Put your PIC into bootloading mode. You should now be able to select (some string) from the (some string).exe drop-down list. Now click &amp;quot;Load Hex File&amp;quot; and go find the hex file that you created when you compiled your program. Then click &amp;quot;Program Device&amp;quot; to load your program. Reset your PIC and your program should run.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
[[USB communication with PC]]&lt;/div&gt;</summary>
		<author><name>Kwang Sim</name></author>
	</entry>
	<entry>
		<id>https://hades.mech.northwestern.edu//index.php?title=USB_bootloading&amp;diff=13068</id>
		<title>USB bootloading</title>
		<link rel="alternate" type="text/html" href="https://hades.mech.northwestern.edu//index.php?title=USB_bootloading&amp;diff=13068"/>
		<updated>2009-04-20T22:44:43Z</updated>

		<summary type="html">&lt;p&gt;Kwang Sim: by Greg McGlynn&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;#039;&amp;#039;&amp;#039;This article assumes you are using Windows.&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Bootloading allows you to reprogram your PIC without the need for an expensive hardware programmer like an ICD. &lt;br /&gt;
&lt;br /&gt;
Bootloading works like this:&lt;br /&gt;
* You compile your program on the computer, which generates a file with a .hex extension. This is the compiled code for your program, which you want to get onto the PIC. &lt;br /&gt;
* You connect the PIC to the computer, in this case with a simple USB cable. &lt;br /&gt;
* You fire up a PC program that takes your hex file and sends it to the PIC.&lt;br /&gt;
* Sitting on the PIC there is a small program called a bootloader. It takes the hex file that is coming from the computer and writes it into memory. &lt;br /&gt;
* You reset the PIC, and your program starts running!&lt;br /&gt;
&lt;br /&gt;
== USB Bootloading with the PIC 18f4553 ==&lt;br /&gt;
USB bootloading is bootloading over a USB cable. To do this you need to be working with a PIC that talks USB, like an 18f4553. Then you need to have a bootloader on the PIC. The only way to put a bootloader in place is with a hardware programmer like an ICD, but you only need to do this once: afterwards, all you&amp;#039;ll need is a regular USB cable. See [[USB communication with PC|here]] for how to connect a USB cable to a PIC.&lt;br /&gt;
&lt;br /&gt;
=== Loading the bootloader ===&lt;br /&gt;
Here is a USB bootloader hex file that works for the 18f4553 with a 20Mhz oscillator: [[FW_B_20.hex]]. It comes from http://www.schmalzhaus.com/UBW , where you can find the source it was built from, if you&amp;#039;re interested.&lt;br /&gt;
To load this precompiled hex file onto the PIC using the CCS ICD, use the icd.exe program in the C:\Program Files\PICC directory. Now the bootloader is itself loaded.&lt;br /&gt;
&lt;br /&gt;
=== The PC software ===&lt;br /&gt;
There needs to be a program on the PC that sends your hex files to bootloader on the PIC. This bootloader uses a program from the Microchip USB Framework. You can download the framework installer [http://ww1.microchip.com/downloads/en/DeviceDoc/MCHPFSUSB_Setup_v1.3.exe here]. It will create some folders in the C:\ directory. The loader program is at (some location).&lt;br /&gt;
&lt;br /&gt;
=== Required circuitry ===&lt;br /&gt;
You need some sort of button or switch hooked up to pin RC2 so that it is normally high. If you reset the PIC and pin RC2 is high, the bootloader will run whatever program you&amp;#039;ve loaded onto it. But if RC2 is low, because you&amp;#039;re pressing the button, the bootloader will run, allowing you to load a new program onto the PIC. You don&amp;#039;t need to keep holding the button down, C2 just has to be low at the time the PIC resets. So whenever you want to put the PIC into bootloader mode, press and hold the reset button, then press your bootloading button, then release the reset button, then release the bootloading button. You can attach an LED to pin RC1 and the bootloader will flash it when it runs. &lt;br /&gt;
&lt;br /&gt;
=== Installing Drivers ===&lt;br /&gt;
When you first connect the PIC to the PC and make the bootloader run, Windows will need to install a driver. Point it to (some location) and it will install the right driver. Now you&amp;#039;re all set up.&lt;br /&gt;
&lt;br /&gt;
=== Compiling for a bootloader ===&lt;br /&gt;
A bootloader takes up part of the available program memory, and you need to take this into account when you write your program. Generally, the bootloader takes up a small chunk of memory at the beginning of space available for program memory. You need to tell the compiler to place your code just after the bootloader. Our bootloader takes up the memory from 0x000 to 0x7FF (the first two kilobytes of program memory). Your program therefore needs to start at address 0x800 and not touch the memory from 0x000 to 0x7FF. You can do this by adding the following two lines at the top of your code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;#build (reset=0x800, interrupt=0x808)  //code starts right after the bootloader&lt;br /&gt;
#org 0, 0x7FF {}                       //don&amp;#039;t overwrite the bootloader&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Bootloading ===&lt;br /&gt;
So you&amp;#039;ve compiled your program and want to load it on to your PIC. Fire up (some location).exe. Put your PIC into bootloading mode. You should now be able to select (some string) from the (some string).exe drop-down list. Now click &amp;quot;Load Hex File&amp;quot; and go find the hex file that you created when you compiled your program. Then click &amp;quot;Program Device&amp;quot; to load your program. Reset your PIC and your program should run.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
[[USB communication with PC]]&lt;/div&gt;</summary>
		<author><name>Kwang Sim</name></author>
	</entry>
	<entry>
		<id>https://hades.mech.northwestern.edu//index.php?title=USB_communication_with_PC&amp;diff=13067</id>
		<title>USB communication with PC</title>
		<link rel="alternate" type="text/html" href="https://hades.mech.northwestern.edu//index.php?title=USB_communication_with_PC&amp;diff=13067"/>
		<updated>2009-04-20T22:40:10Z</updated>

		<summary type="html">&lt;p&gt;Kwang Sim: by Greg McGlynn&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Some PIC models have built-in USB transceivers that make it simple to connect the PIC to a computer via USB. One such PIC is the 18f4553, which is similar to the 18f4520 in almost all respects, except that it has hardware support for USB built into it. The 18f4553 will work just fine in one of the [[4520_Board_intro|PIC protoboards]]. &lt;br /&gt;
&lt;br /&gt;
I&amp;#039;m not clear on how cross-platform USB software tends to be. &amp;#039;&amp;#039;&amp;#039;This article currently assumes you&amp;#039;re running Windows.&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
== The USB protocol ==&lt;br /&gt;
USB is a pretty complex protocol with a long specification, but it&amp;#039;s not necessary to understand every part of it to use it. It&amp;#039;s enough to know what wires to hook up and what software libraries to include in your code, and using USB will be easy. &lt;br /&gt;
&lt;br /&gt;
Wikipedia has a detailed and informative [http://en.wikipedia.org/wiki/Usb page on USB]. &lt;br /&gt;
&lt;br /&gt;
USB connectors have four leads; the pictures on Wikipedia show which is which on standard connectors.&lt;br /&gt;
* +5V: the host [computer] provides up to 500mA of current at 5V that you can use for power. If your PIC is self-powered, though, make sure you don&amp;#039;t connect the two +5V sources or bad things may happen.&lt;br /&gt;
* GND: ground; make sure you do connect this to your PIC&amp;#039;s ground.&lt;br /&gt;
* D+ and D-: data is transmitted on these lines. The exact protocol is complicated and you probably don&amp;#039;t need to know the details.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== USB with the PIC 18F4553 ==&lt;br /&gt;
=== Hardware ===&lt;br /&gt;
On the 18f4553, the D+ line connects to pin RC5 and the D- line to pin RC4. The ground line of course connects to ground.&lt;br /&gt;
&lt;br /&gt;
Additionally pin 18, called Vusb, should have a capacitor to ground. Try 220 or 470nF.&lt;br /&gt;
&lt;br /&gt;
=== Software ===&lt;br /&gt;
On the software side you have some choices. Probably the simplest thing to do is use a preexisting software library that makes the USB connection look like an [[PIC RS232|RS232 connection]]. The CCS compiler has a CDC library that provides functions like usb_cdc_getc or usb_cdc_putc that work over USB exactly like regular getc and putc work over RS232. CCS also provides a Windows driver for the PC that creates a virtual COM port that you can open in Matlab or Hyperterminal and use to talk to the PIC.&lt;br /&gt;
&lt;br /&gt;
A sample program using CCS&amp;#039;s CDC library is shown below. The program waits for some input and then responds to it. When you first plug in the PIC to the computer, Windows will need to install a driver to talk to it. If you&amp;#039;re running XP or earlier, point it to the directory C:\Program Files\PICC\Drivers, where it will find what it needs. If you&amp;#039;re running Vista the driver may not be there; download [[Image:Cdc_NTXPVista.inf]], save it somewhere, and point Windows to it. Once the driver is installed a virtual COM port will be created (it will be visible in the device manager) and you&amp;#039;ll be able to talk to the PIC in Hyperterminal, Matlab, or anything else that communications over RS232.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;#include &amp;lt;18f4550.h&amp;gt; //if your version of the compiler doesn&amp;#039;t support the 4553, you can put the 4550 in your code, which is almost exactly the same.&lt;br /&gt;
#fuses HS, NOWDT, NOLVP, NOPROTECT //standard fuses&lt;br /&gt;
&lt;br /&gt;
//these fuses are critical. they assume a 20Mhz oscillator:&lt;br /&gt;
#fuses PLL5     //The USB module must run at 48Mhz. This tells the PIC to take the oscillator, divide the frequency by 5, then multiply by 12. The result must be 48Mhz. &lt;br /&gt;
#fuses HSPLL    //I&amp;#039;m not exactly sure what this fuses does, but it&amp;#039;s probably necessary.&lt;br /&gt;
#fuses VREGEN   //The USB module must run at 3.3V. This tells the PIC to accomplish this by using an internal voltage regulator.&lt;br /&gt;
#fuses CPUDIV1  //This tells the PIC to run at a frequency of 48Mhz / 1 = 48Mhz. It may or may not be necessary.&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt;usb_cdc.h&amp;gt; //Include the CCS USB library. If you want to see all the functions available look at usb_cdc.h and usb.h.&lt;br /&gt;
&lt;br /&gt;
void main() {&lt;br /&gt;
   int c;&lt;br /&gt;
&lt;br /&gt;
   //these lines do some initialization, obviously:&lt;br /&gt;
   usb_cdc_init();&lt;br /&gt;
   usb_init();&lt;br /&gt;
&lt;br /&gt;
   while(true) {&lt;br /&gt;
       usb_task(); //handles connections to and disconnections from the computer, registering the PIC with the computer, etc. call this pretty often so that the PIC responds to being plugged in. &lt;br /&gt;
       &lt;br /&gt;
       if(usb_cdc_kbhit()) { //did we get some incoming data? &lt;br /&gt;
           c = usb_cdc_getc(); //get one character of input&lt;br /&gt;
           printf(usb_cdc_putc, &amp;quot;you typed: %c\r\n&amp;quot;, c); //print out a response over usb&lt;br /&gt;
       }&lt;br /&gt;
   }&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
CCS also has an example where the PIC registers itself as a Human Interface Device (HID). USB mice and keyboards use HID. The advantage of this is that doesn&amp;#039;t require the user to install a special driver. The disadvantages are (a) the connection doesn&amp;#039;t look like a simple RS232 link and (b) bandwidth is limited. A HID can only send messages to the computer once every millisecond, and can only send 64 bytes in each message, so the maximum data transfer rate is 64K bytes/second. In theory, USB can go up to 12M bits/second, so HID is fairly slow in comparison. &lt;br /&gt;
&lt;br /&gt;
Microchip provides a USB framework for use with its [[PIC Microcontrollers with C18 Compiler|C18 compiler]]. &lt;br /&gt;
&lt;br /&gt;
It&amp;#039;s also possible to create one&amp;#039;s own setup from scratch or by modifying a preexisting library. This probably takes some effort.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
[[USB Bootloading]]&lt;/div&gt;</summary>
		<author><name>Kwang Sim</name></author>
	</entry>
	<entry>
		<id>https://hades.mech.northwestern.edu//index.php?title=Rs232&amp;diff=13066</id>
		<title>Rs232</title>
		<link rel="alternate" type="text/html" href="https://hades.mech.northwestern.edu//index.php?title=Rs232&amp;diff=13066"/>
		<updated>2009-04-20T22:32:05Z</updated>

		<summary type="html">&lt;p&gt;Kwang Sim: Redirecting to PIC RS232&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#REDIRECT [[PIC RS232]]&lt;/div&gt;</summary>
		<author><name>Kwang Sim</name></author>
	</entry>
	<entry>
		<id>https://hades.mech.northwestern.edu//index.php?title=USB&amp;diff=13065</id>
		<title>USB</title>
		<link rel="alternate" type="text/html" href="https://hades.mech.northwestern.edu//index.php?title=USB&amp;diff=13065"/>
		<updated>2009-04-20T22:31:24Z</updated>

		<summary type="html">&lt;p&gt;Kwang Sim: Redirecting to USB communication with PC&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#REDIRECT [[USB communication with PC]]&lt;/div&gt;</summary>
		<author><name>Kwang Sim</name></author>
	</entry>
	<entry>
		<id>https://hades.mech.northwestern.edu//index.php?title=USB_Bootloading&amp;diff=13064</id>
		<title>USB Bootloading</title>
		<link rel="alternate" type="text/html" href="https://hades.mech.northwestern.edu//index.php?title=USB_Bootloading&amp;diff=13064"/>
		<updated>2009-04-20T22:30:33Z</updated>

		<summary type="html">&lt;p&gt;Kwang Sim: Redirecting to USB bootloading&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#REDIRECT [[USB bootloading]]&lt;/div&gt;</summary>
		<author><name>Kwang Sim</name></author>
	</entry>
	<entry>
		<id>https://hades.mech.northwestern.edu//index.php?title=USB_communication_with_PC&amp;diff=13063</id>
		<title>USB communication with PC</title>
		<link rel="alternate" type="text/html" href="https://hades.mech.northwestern.edu//index.php?title=USB_communication_with_PC&amp;diff=13063"/>
		<updated>2009-04-20T22:29:53Z</updated>

		<summary type="html">&lt;p&gt;Kwang Sim: by Greg McGlynn&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Some PIC models have built-in USB transceivers that make it simple to connect the PIC to a computer via USB. One such PIC is the 18f4553, which is similar to the 18f4520 in almost all respects, except that it has hardware support for USB built into it. The 18f4553 will work just fine in one of the [[4520_Board_intro|PIC protoboards]]. &lt;br /&gt;
&lt;br /&gt;
I&amp;#039;m not clear on how cross-platform USB software tends to be. &amp;#039;&amp;#039;&amp;#039;This article currently assumes you&amp;#039;re running Windows.&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
== The USB protocol ==&lt;br /&gt;
USB is a pretty complex protocol with a long specification, but it&amp;#039;s not necessary to understand every part of it to use it. It&amp;#039;s enough to know what wires to hook up and what software libraries to include in your code, and using USB will be easy. &lt;br /&gt;
&lt;br /&gt;
Wikipedia has a detailed and informative [http://en.wikipedia.org/wiki/Usb page on USB]. &lt;br /&gt;
&lt;br /&gt;
USB connectors have four leads; the pictures on Wikipedia show which is which on standard connectors.&lt;br /&gt;
* +5V: the host [computer] provides up to 500mA of current at 5V that you can use for power. If your PIC is self-powered, though, make sure you don&amp;#039;t connect the two +5V sources or bad things may happen.&lt;br /&gt;
* GND: ground; make sure you do connect this to your PIC&amp;#039;s ground.&lt;br /&gt;
* D+ and D-: data is transmitted on these lines. The exact protocol is complicated and you probably don&amp;#039;t need to know the details.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== USB with the PIC 18F4553 ==&lt;br /&gt;
=== Hardware ===&lt;br /&gt;
On the 18f4553, the D+ line connects to pin RC5 and the D- line to pin RC4. The ground line of course connects to ground. Hook these up and your circuit is ready to talk USB. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Software ===&lt;br /&gt;
On the software side you have some choices. Probably the simplest thing to do is use a preexisting software library that makes the USB connection look like an [[PIC RS232|RS232 connection]]. The CCS compiler has a CDC library that provides functions like usb_cdc_getc or usb_cdc_putc that work over USB exactly like regular getc and putc work over RS232. CCS also provides a Windows driver for the PC that creates a virtual COM port that you can open in Matlab or Hyperterminal and use to talk to the PIC.&lt;br /&gt;
&lt;br /&gt;
A sample program using CCS&amp;#039;s CDC library is shown below. The program waits for some input and then responds to it. When you first plug in the PIC to the computer, Windows will need to install a driver to talk to it. If you&amp;#039;re running XP or earlier, point it to the directory C:\Program Files\PICC\Drivers, where it will find what it needs. If you&amp;#039;re running Vista the driver may not be there; download [[Image:Cdc_NTXPVista.inf]], save it somewhere, and point Windows to it. Once the driver is installed a virtual COM port will be created (it will be visible in the device manager) and you&amp;#039;ll be able to talk to the PIC in Hyperterminal, Matlab, or anything else that communications over RS232.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;#include &amp;lt;18f4550.h&amp;gt; //if your version of the compiler doesn&amp;#039;t support the 4553, you can put the 4550 in your code, which is almost exactly the same.&lt;br /&gt;
#fuses HS, NOWDT, NOLVP, NOPROTECT //standard fuses&lt;br /&gt;
&lt;br /&gt;
//these fuses are critical. they assume a 20Mhz oscillator:&lt;br /&gt;
#fuses PLL5     //The USB module must run at 48Mhz. This tells the PIC to take the oscillator, divide the frequency by 5, then multiply by 12. The result must be 48Mhz. &lt;br /&gt;
#fuses HSPLL    //I&amp;#039;m not exactly sure what this fuses does, but it&amp;#039;s probably necessary.&lt;br /&gt;
#fuses VREGEN   //The USB module must run at 3.3V. This tells the PIC to accomplish this by using an internal voltage regulator.&lt;br /&gt;
#fuses CPUDIV1  //This tells the PIC to run at a frequency of 48Mhz / 1 = 48Mhz. It may or may not be necessary.&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt;usb_cdc.h&amp;gt; //Include the CCS USB library. If you want to see all the functions available look at usb_cdc.h and usb.h.&lt;br /&gt;
&lt;br /&gt;
void main() {&lt;br /&gt;
   int c;&lt;br /&gt;
&lt;br /&gt;
   //these lines do some initialization, obviously:&lt;br /&gt;
   usb_cdc_init();&lt;br /&gt;
   usb_init();&lt;br /&gt;
&lt;br /&gt;
   while(true) {&lt;br /&gt;
       usb_task(); //handles connections to and disconnections from the computer, registering the PIC with the computer, etc. call this pretty often so that the PIC responds to being plugged in. &lt;br /&gt;
       &lt;br /&gt;
       if(usb_cdc_kbhit()) { //did we get some incoming data? &lt;br /&gt;
           c = usb_cdc_getc(); //get one character of input&lt;br /&gt;
           printf(usb_cdc_putc, &amp;quot;you typed: %c\r\n&amp;quot;, c); //print out a response over usb&lt;br /&gt;
       }&lt;br /&gt;
   }&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
CCS also has an example where the PIC registers itself as a Human Interface Device (HID). USB mice and keyboards use HID. The advantage of this is that doesn&amp;#039;t require the user to install a special driver. The disadvantages are (a) the connection doesn&amp;#039;t look like a simple RS232 link and (b) bandwidth is limited. A HID can only send messages to the computer once every millisecond, and can only send 64 bytes in each message, so the maximum data transfer rate is 64K bytes/second. In theory, USB can go up to 12M bits/second, so HID is fairly slow in comparison. &lt;br /&gt;
&lt;br /&gt;
Microchip provides a USB framework for use with its [[PIC Microcontrollers with C18 Compiler|C18 compiler]]. &lt;br /&gt;
&lt;br /&gt;
It&amp;#039;s also possible to create one&amp;#039;s own setup from scratch or by modifying a preexisting library. This probably takes some effort.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
[[USB Bootloading]]&lt;/div&gt;</summary>
		<author><name>Kwang Sim</name></author>
	</entry>
	<entry>
		<id>https://hades.mech.northwestern.edu//index.php?title=USB_bootloading&amp;diff=13062</id>
		<title>USB bootloading</title>
		<link rel="alternate" type="text/html" href="https://hades.mech.northwestern.edu//index.php?title=USB_bootloading&amp;diff=13062"/>
		<updated>2009-04-20T22:27:13Z</updated>

		<summary type="html">&lt;p&gt;Kwang Sim: by Greg McGlynn&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;#039;&amp;#039;&amp;#039;This article assumes you are using Windows.&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Bootloading allows you to reprogram your PIC without the need for an expensive hardware programmer like an ICD. &lt;br /&gt;
&lt;br /&gt;
Bootloading works like this:&lt;br /&gt;
* You compile your program on the computer, which generates a file with a .hex extension. This is the compiled code for your program, which you want to get onto the PIC. &lt;br /&gt;
* You connect the PIC to the computer, in this case with a simple USB cable. &lt;br /&gt;
* You fire up a PC program that takes your hex file and sends it to the PIC.&lt;br /&gt;
* Sitting on the PIC there is a small program called a bootloader. It takes the hex file that is coming from the computer and writes it into memory. &lt;br /&gt;
* You reset the PIC, and your program starts running!&lt;br /&gt;
&lt;br /&gt;
== USB Bootloading with the PIC 18f4553 ==&lt;br /&gt;
USB bootloading is bootloading over a USB cable. To do this you need to be working with a PIC that talks USB, like an 18f4553. Then you need to have a bootloader on the PIC. The only way to put a bootloader in place is with a hardware programmer like an ICD, but you only need to do this once: afterwards, all you&amp;#039;ll need is a regular USB cable. See [[USB communication with PC|here]] for how to connect a USB cable to a PIC.&lt;br /&gt;
&lt;br /&gt;
=== Loading the bootloader ===&lt;br /&gt;
Here is a USB bootloader hex file that works for the 18f4553 with a 20Mhz oscillator: [[FW_B_20.hex]]. It comes from http://www.schmalzhaus.com/UBW , where you can find the source it was built from, if you&amp;#039;re interested.&lt;br /&gt;
To load this precompiled hex file onto the PIC using the CCS ICD, use the icd.exe program in the C:\Program Files\PICC directory. Now the bootloader is itself loaded.&lt;br /&gt;
&lt;br /&gt;
=== The PC software ===&lt;br /&gt;
There needs to be a program on the PC that sends your hex files to bootloader on the PIC. This bootloader uses a program from the Microchip USB Framework. You can download the framework installer [http://ww1.microchip.com/downloads/en/DeviceDoc/MCHPFSUSB_Setup_v1.3.exe here]. It will create some folders in the C:\ directory. The loader program is at (some location).&lt;br /&gt;
&lt;br /&gt;
=== Required circuitry ===&lt;br /&gt;
You need some sort of button or switch hooked up to pin RC2 so that it is normally high. If you reset the PIC and pin RC2 is high, the bootloader will run whatever program you&amp;#039;ve loaded onto it. But if RC2 is low, because you&amp;#039;re pressing the button, the bootloader will run, allowing you to load a new program onto the PIC. You don&amp;#039;t need to keep holding the button down, C2 just has to be low at the time the PIC resets. So whenever you want to put the PIC into bootloader mode, press and hold the reset button, then press your bootloading button, then release the reset button, then release the bootloading button. You can attach an LED to pin RC1 and the bootloader will flash it when it runs. &lt;br /&gt;
&lt;br /&gt;
=== Installing Drivers ===&lt;br /&gt;
When you first connect the PIC to the PC and make the bootloader run, Windows will need to install a driver. Point it to (some location) and it will install the right driver. Now you&amp;#039;re all set up.&lt;br /&gt;
&lt;br /&gt;
=== Bootloading ===&lt;br /&gt;
So you&amp;#039;ve compiled your program and want to load it on to your PIC. Fire up (some location).exe. Put your PIC into bootloading mode. You should now be able to select (some string) from the (some string).exe drop-down list. Now click &amp;quot;Load Hex File&amp;quot; and go find the hex file that you created when you compiled your program. Then click &amp;quot;Program Device&amp;quot; to load your program. Reset your PIC and your program should run.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
[[USB communication with PC]]&lt;/div&gt;</summary>
		<author><name>Kwang Sim</name></author>
	</entry>
	<entry>
		<id>https://hades.mech.northwestern.edu//index.php?title=USB_bootloading&amp;diff=13061</id>
		<title>USB bootloading</title>
		<link rel="alternate" type="text/html" href="https://hades.mech.northwestern.edu//index.php?title=USB_bootloading&amp;diff=13061"/>
		<updated>2009-04-20T22:17:28Z</updated>

		<summary type="html">&lt;p&gt;Kwang Sim: by Greg McGlynn&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;#039;&amp;#039;&amp;#039;This article assumes you are using Windows.&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Bootloading allows you to reprogram your PIC without the need for an expensive hardware programmer like an ICD. &lt;br /&gt;
&lt;br /&gt;
Bootloading works like this:&lt;br /&gt;
* You compile your program on the computer, which generates a file with a .hex extension. This is the compiled code for your program, which you want to get onto the PIC. &lt;br /&gt;
* You connect the PIC to the computer, in this case with a simple USB cable. &lt;br /&gt;
* You fire up a PC program that takes your hex file and sends it to the PIC.&lt;br /&gt;
* Sitting on the PIC there is a small program called a bootloader. It takes the hex file that is coming from the computer and writes it into memory. &lt;br /&gt;
* You reset the PIC, and your program starts running!&lt;br /&gt;
&lt;br /&gt;
== USB Bootloading with the PIC 18f4553 ==&lt;br /&gt;
USB bootloading is bootloading over a USB cable. To do this you need to be working with a PIC that talks USB, like an 18f4553. Then you need to have a bootloader on the PIC. The only way to put a bootloader in place is with a hardware programmer like an ICD, but you only need to do this once: afterwards, all you&amp;#039;ll need is a regular USB cable. See [[USB communication with PC|here]] for how to connect a USB cable to a PIC.&lt;br /&gt;
&lt;br /&gt;
=== Loading the bootloader ===&lt;br /&gt;
Here is a USB bootloader hex file that works for the 18f4553 with a 20Mhz oscillator: [[FW_B_20.hex]]. It comes from http://www.schmalzhaus.com/UBW&lt;br /&gt;
To load this precompiled hex file onto the PIC using the CCS ICD, use the icd.exe program in the C:\Program Files\PICC directory. Now the bootloader is itself loaded.&lt;br /&gt;
&lt;br /&gt;
=== The PC end ===&lt;br /&gt;
There needs to be a program on the PC that sends your hex files to bootloader on the PIC. This bootloader uses a program from the Microchip USB Framework. You can download the framework installer [http://ww1.microchip.com/downloads/en/DeviceDoc/MCHPFSUSB_Setup_v1.3.exe here]. It will create some folders in the C:\ directory. The loader program is at (some location).&lt;br /&gt;
&lt;br /&gt;
=== Required hardware ===&lt;br /&gt;
You need some sort of button or switch hooked up to pin RC2 so that it is normally high. If you reset the PIC and pin RC2 is high, the bootloader will run whatever program you&amp;#039;ve loaded onto it. But if RC2 is low, because you&amp;#039;re pressing the button, the bootloader will run, allowing you to load a new program onto the PIC. You don&amp;#039;t need to keep holding the button down, C2 just has to be low at the time the PIC resets. You can attach an LED to pin RC1 and the bootloader will flash it when it runs. &lt;br /&gt;
&lt;br /&gt;
=== Installing Drivers ===&lt;br /&gt;
When you first connect the PIC to the&lt;/div&gt;</summary>
		<author><name>Kwang Sim</name></author>
	</entry>
	<entry>
		<id>https://hades.mech.northwestern.edu//index.php?title=File:FW_B_20.hex&amp;diff=13060</id>
		<title>File:FW B 20.hex</title>
		<link rel="alternate" type="text/html" href="https://hades.mech.northwestern.edu//index.php?title=File:FW_B_20.hex&amp;diff=13060"/>
		<updated>2009-04-20T22:00:26Z</updated>

		<summary type="html">&lt;p&gt;Kwang Sim: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Kwang Sim</name></author>
	</entry>
	<entry>
		<id>https://hades.mech.northwestern.edu//index.php?title=USB_communication_with_PC&amp;diff=13059</id>
		<title>USB communication with PC</title>
		<link rel="alternate" type="text/html" href="https://hades.mech.northwestern.edu//index.php?title=USB_communication_with_PC&amp;diff=13059"/>
		<updated>2009-04-20T21:49:27Z</updated>

		<summary type="html">&lt;p&gt;Kwang Sim: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Some PIC models have built-in USB transceivers that make it simple to connect the PIC to a computer via USB. One such PIC is the 18f4553, which is similar to the 18f4520 in almost all respects, except that it has hardware support for USB built into it. The 18f4553 will work just fine in one of the [[4520_Board_intro|PIC protoboards]]. &lt;br /&gt;
&lt;br /&gt;
I&amp;#039;m not clear on how cross-platform USB software tends to be. &amp;#039;&amp;#039;&amp;#039;This article currently assumes you&amp;#039;re running Windows.&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
== The USB protocol ==&lt;br /&gt;
USB is a pretty complex protocol with a long specification, but it&amp;#039;s not necessary to understand every part of it to use it. It&amp;#039;s enough to know what wires to hook up and what software libraries to include in your code, and using USB will be easy. &lt;br /&gt;
&lt;br /&gt;
Wikipedia has a detailed and informative [http://en.wikipedia.org/wiki/Usb page on USB]. &lt;br /&gt;
&lt;br /&gt;
USB connectors have four leads; the pictures on Wikipedia show which is which on standard connectors.&lt;br /&gt;
* +5V: the host [computer] provides up to 500mA of current at 5V that you can use for power. If your PIC is self-powered, though, make sure you don&amp;#039;t connect the two +5V sources or bad things may happen.&lt;br /&gt;
* GND: ground; make sure you do connect this to your PIC&amp;#039;s ground.&lt;br /&gt;
* D+ and D-: data is transmitted on these lines. The exact protocol is complicated and you probably don&amp;#039;t need to know the details.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== USB with the PIC 18F4553 ==&lt;br /&gt;
=== Hardware ===&lt;br /&gt;
On the 18f4553, the D+ line connects to pin RC5 and the D- line to pin RC4. The ground line of course connects to ground. Hook these up and your circuit is ready to talk USB. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Software ===&lt;br /&gt;
On the software side you have some choices. Probably the simplest thing to do is use a preexisting software library that makes the USB connection look like an [[PIC RS232|RS232 connection]]. The CCS compiler has a CDC library that provides functions like usb_cdc_getc or usb_cdc_putc that work over USB exactly like regular getc and putc work over RS232. CCS also provides a Windows driver for the PC that creates a virtual COM port that you can open in Matlab or Hyperterminal and use to talk to the PIC.&lt;br /&gt;
&lt;br /&gt;
A sample program using CCS&amp;#039;s CDC library is shown below. The program waits for some input and then responds to it. When you first plug in the PIC to the computer, Windows will need to install a driver to talk to it. If you&amp;#039;re running XP or earlier, point it to the directory C:\Program Files\PICC\Drivers, where it will find what it needs. If you&amp;#039;re running Vista the driver may not be there; download [[Cdc_NTXPVista.inf]], save it somewhere, and point Windows to it. Once the driver is installed a virtual COM port will be created (it will be visible in the device manager) and you&amp;#039;ll be able to talk to the PIC in Hyperterminal, Matlab, or anything else that communications over RS232.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;#include &amp;lt;18f4550.h&amp;gt; //if your version of the compiler doesn&amp;#039;t support the 4553, you can put the 4550 in your code, which is almost exactly the same.&lt;br /&gt;
#fuses HS, NOWDT, NOLVP, NOPROTECT //standard fuses&lt;br /&gt;
&lt;br /&gt;
//these fuses are critical. they assume a 20Mhz oscillator:&lt;br /&gt;
#fuses PLL5     //The USB module must run at 48Mhz. This tells the PIC to take the oscillator, divide the frequency by 5, then multiply by 12. The result must be 48Mhz. &lt;br /&gt;
#fuses HSPLL    //I&amp;#039;m not exactly sure what this fuses does, but it&amp;#039;s probably necessary.&lt;br /&gt;
#fuses VREGEN   //The USB module must run at 3.3V. This tells the PIC to accomplish this by using an internal voltage regulator.&lt;br /&gt;
#fuses CPUDIV1  //This tells the PIC to run at a frequency of 48Mhz / 1 = 48Mhz. It may or may not be necessary.&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt;usb_cdc.h&amp;gt; //Include the CCS USB library. If you want to see all the functions available look at usb_cdc.h and usb.h.&lt;br /&gt;
&lt;br /&gt;
void main() {&lt;br /&gt;
   int c;&lt;br /&gt;
&lt;br /&gt;
   //these lines do some initialization, obviously:&lt;br /&gt;
   usb_cdc_init();&lt;br /&gt;
   usb_init();&lt;br /&gt;
&lt;br /&gt;
   while(true) {&lt;br /&gt;
       usb_task(); //handles connections to and disconnections from the computer, registering the PIC with the computer, etc. call this pretty often so that the PIC responds to being plugged in. &lt;br /&gt;
       &lt;br /&gt;
       if(usb_cdc_kbhit()) { //did we get some incoming data? &lt;br /&gt;
           c = usb_cdc_getc(); //get one character of input&lt;br /&gt;
           printf(usb_cdc_putc, &amp;quot;you typed: %c\r\n&amp;quot;, c); //print out a response over usb&lt;br /&gt;
       }&lt;br /&gt;
   }&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
CCS also has an example where the PIC registers itself as a Human Interface Device (HID). USB mice and keyboards use HID. The advantage of this is that doesn&amp;#039;t require the user to install a special driver. The disadvantages are (a) the connection doesn&amp;#039;t look like a simple RS232 link and (b) bandwidth is limited. A HID can only send messages to the computer once every millisecond, and can only send 64 bytes in each message, so the maximum data transfer rate is 64K bytes/second. In theory, USB can go up to 12M bits/second, so HID is fairly slow in comparison. &lt;br /&gt;
&lt;br /&gt;
Microchip provides a USB framework for use with its [[PIC Microcontrollers with C18 Compiler|C18 compiler]]. &lt;br /&gt;
&lt;br /&gt;
It&amp;#039;s also possible to create one&amp;#039;s own setup from scratch or by modifying a preexisting library. This probably takes some effort.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
[[USB Bootloading]]&lt;/div&gt;</summary>
		<author><name>Kwang Sim</name></author>
	</entry>
	<entry>
		<id>https://hades.mech.northwestern.edu//index.php?title=USB_communication_with_PC&amp;diff=13058</id>
		<title>USB communication with PC</title>
		<link rel="alternate" type="text/html" href="https://hades.mech.northwestern.edu//index.php?title=USB_communication_with_PC&amp;diff=13058"/>
		<updated>2009-04-20T21:49:00Z</updated>

		<summary type="html">&lt;p&gt;Kwang Sim: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Some PIC models have built-in USB transceivers that make it simple to connect the PIC to a computer via USB. One such PIC is the 18f4553, which is similar to the 18f4520 in almost all respects, except that it has hardware support for USB built into it. The 18f4553 will work just fine in one of the [[4520_Board_intro|PIC protoboards]]. &lt;br /&gt;
&lt;br /&gt;
I&amp;#039;m not clear on how cross-platform USB software tends to be. &amp;#039;&amp;#039;&amp;#039;This article currently assumes you&amp;#039;re running Windows.&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
== The USB protocol ==&lt;br /&gt;
USB is a pretty complex protocol with a long specification, but it&amp;#039;s not necessary to understand every part of it to use it. It&amp;#039;s enough to know what wires to hook up and what software libraries to include in your code, and using USB will be easy. &lt;br /&gt;
&lt;br /&gt;
Wikipedia has a detailed and informative [http://en.wikipedia.org/wiki/Usb page on USB]. &lt;br /&gt;
&lt;br /&gt;
USB connectors have four leads; the pictures on Wikipedia show which is which on standard connectors.&lt;br /&gt;
* +5V: the host [computer] provides up to 500mA of current at 5V that you can use for power. If your PIC is self-powered, though, make sure you don&amp;#039;t connect the two +5V sources or bad things may happen.&lt;br /&gt;
* GND: ground; make sure you do connect this to your PIC&amp;#039;s ground.&lt;br /&gt;
* D+ and D-: data is transmitted on these lines. The exact protocol is complicated and you probably don&amp;#039;t need to know the details.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== USB with the PIC 18F4553 ==&lt;br /&gt;
=== Hardware ===&lt;br /&gt;
On the 18f4553, the D+ line connects to pin RC5 and the D- line to pin RC4. The ground line of course connects to ground. Hook these up and your circuit is ready to talk USB. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Software ===&lt;br /&gt;
On the software side you have some choices. Probably the simplest thing to do is use a preexisting software library that makes the USB connection look like an [[PIC RS232|RS232 connection]]. The CCS compiler has a CDC library that provides functions like usb_cdc_getc or usb_cdc_putc that work over USB exactly like regular getc and putc work over RS232. CCS also provides a Windows driver for the PC that creates a virtual COM port that you can open in Matlab or Hyperterminal and use to talk to the PIC.&lt;br /&gt;
&lt;br /&gt;
A sample program using CCS&amp;#039;s CDC library is shown below. The program waits for some input and then responds to it. When you first plug in the PIC to the computer, Windows will need to install a driver to talk to it. If you&amp;#039;re running XP or earlier, point it to the directory C:\Program Files\PICC\Drivers, where it will find what it needs. If you&amp;#039;re running Vista the driver may not be there; download [[Cdc_NTXPVista.inf]], save it somewhere, and point Windows to it. Once the driver is installed a virtual COM port will be created (it will be visible in the device manager) and you&amp;#039;ll be able to talk to the PIC in Hyperterminal, Matlab, or anything else that communications over RS232.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;#include &amp;lt;18f4550.h&amp;gt; //if your version of the compiler doesn&amp;#039;t support the 4553, you can put the 4550 in your code, which is almost exactly the same.&lt;br /&gt;
#fuses HS, NOWDT, NOLVP, NOPROTECT //standard fuses&lt;br /&gt;
&lt;br /&gt;
//these fuses are critical. they assume a 20Mhz oscillator:&lt;br /&gt;
#fuses PLL5     //The USB module must run at 48Mhz. This tells the PIC to take the oscillator, divide the frequency by 5, then multiply by 12. The result must be 48Mhz. &lt;br /&gt;
#fuses HSPLL    //I&amp;#039;m not exactly sure what this fuses does, but it&amp;#039;s probably necessary.&lt;br /&gt;
#fuses VREGEN   //The USB module must run at 3.3V. This tells the PIC to accomplish this by using an internal voltage regulator.&lt;br /&gt;
#fuses CPUDIV1  //This tells the PIC to run at a frequency of 48Mhz / 1 = 48Mhz. It may or may not be necessary.&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt;usb_cdc.h&amp;gt; //Include the CCS USB library. If you want to see all the functions available look at usb_cdc.h and usb.h.&lt;br /&gt;
&lt;br /&gt;
void main() {&lt;br /&gt;
   int c;&lt;br /&gt;
&lt;br /&gt;
   //these lines do some initialization, obviously:&lt;br /&gt;
   usb_cdc_init();&lt;br /&gt;
   usb_init();&lt;br /&gt;
&lt;br /&gt;
   while(true) {&lt;br /&gt;
       usb_task(); //handles connections to and disconnections from the computer, registering the PIC with the computer, etc. call this pretty often so that the PIC responds to being plugged in. &lt;br /&gt;
       &lt;br /&gt;
       if(usb_cdc_kbhit()) { //did we get some incoming data? &lt;br /&gt;
           c = usb_cdc_getc(); //get one character of input&lt;br /&gt;
           printf(usb_cdc_putc, &amp;quot;you typed: %c\r\n&amp;quot;, c); //print out a response over usb&lt;br /&gt;
       }&lt;br /&gt;
   }&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
CCS also has an example where the PIC registers itself as a Human Interface Device (HID). USB mice and keyboards use HID. The advantage of this is that doesn&amp;#039;t require the user to install a special driver. The disadvantages are (a) the connection doesn&amp;#039;t look like a simple RS232 link and (b) bandwidth is limited. A HID can only send messages to the computer once every millisecond, and can only send 64 bytes in each message, so the maximum data transfer rate is 64K bytes/second. In theory, USB can go up to 12M bits/second, so HID is fairly slow in comparison. &lt;br /&gt;
&lt;br /&gt;
Microchip provides a USB framework for use with its [[PIC Microcontrollers with C18 Compiler|C18 compiler]]. &lt;br /&gt;
&lt;br /&gt;
It&amp;#039;s also possible to create one&amp;#039;s own setup from scratch or by modifying a preexisting library. This probably takes some effort.&lt;br /&gt;
&lt;br /&gt;
=== See also ===&lt;br /&gt;
[[USB Bootloading]]&lt;/div&gt;</summary>
		<author><name>Kwang Sim</name></author>
	</entry>
	<entry>
		<id>https://hades.mech.northwestern.edu//index.php?title=File:Cdc_NTXPVista.inf&amp;diff=13057</id>
		<title>File:Cdc NTXPVista.inf</title>
		<link rel="alternate" type="text/html" href="https://hades.mech.northwestern.edu//index.php?title=File:Cdc_NTXPVista.inf&amp;diff=13057"/>
		<updated>2009-04-20T21:40:00Z</updated>

		<summary type="html">&lt;p&gt;Kwang Sim: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Kwang Sim</name></author>
	</entry>
	<entry>
		<id>https://hades.mech.northwestern.edu//index.php?title=USB_communication_with_PC&amp;diff=13056</id>
		<title>USB communication with PC</title>
		<link rel="alternate" type="text/html" href="https://hades.mech.northwestern.edu//index.php?title=USB_communication_with_PC&amp;diff=13056"/>
		<updated>2009-04-20T21:31:41Z</updated>

		<summary type="html">&lt;p&gt;Kwang Sim: by Greg McGlynn&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Some PIC models have built-in USB transceivers that make it simple to connect the PIC to a computer via USB. One such PIC is the 18f4553, which is similar to the 18f4520 in almost all respects, except that a few pins can be used for USB communication. The 18f4553 will work just fine in one of the [[PIC protoboards|4520_Board_intro]]. &lt;br /&gt;
&lt;br /&gt;
== The USB protocol ==&lt;br /&gt;
USB is a pretty complex protocol with a long specification, but it&amp;#039;s not necessary to understand every part of it to use it. It&amp;#039;s enough to know what wires to hook up and what software libraries to include in your code. &lt;br /&gt;
&lt;br /&gt;
Wikipedia has a detailed and informative [page on USB|http://en.wikipedia.org/wiki/Usb]. In particular, USB connectors have four leads:&lt;br /&gt;
&lt;br /&gt;
* +5V (red): the host [computer] provides up to 500mA of current at 5V that you can use for power. If your PIC is self-powered, though, make sure you don&amp;#039;t connect the two +5V sources or bad things may happen.&lt;br /&gt;
* GND (black): ground; make sure you do connect this to your PIC&amp;#039;s ground.&lt;br /&gt;
* D+ (green) and D- (white): data is transmitted on these lines. The exact protocol is complicated.&lt;br /&gt;
&lt;br /&gt;
== USB with the PIC 18F4553 ==&lt;br /&gt;
=== Hardware ===&lt;br /&gt;
On the 18f4553, the D+ line connects to pin RC5 and the D- line to pin RC4. The ground line of course connects to ground. Hook these up and your circuit is ready to talk USB. &lt;br /&gt;
&lt;br /&gt;
=== Software ===&lt;br /&gt;
On the software side you have some choices. Probably the simplest thing to do is use a preexisting software library that makes the USB connection look like an RS232 connection. The CCS compiler has a CDC library that provides functions like usb_cdc_getc or usb_cdc_putc that work over USB exactly like regular getc and putc work over RS232. CCS also provides a Windows driver for the PC that creates a virtual COM port that you can open in Matlab or Hyperterminal and use to talk to the PIC.&lt;br /&gt;
&lt;br /&gt;
A sample program using CCS&amp;#039;s CDC library looks like this:&lt;br /&gt;
&lt;br /&gt;
[code]#include &amp;lt;18f4550.h&amp;gt; //if your version of the compiler doesn&amp;#039;t support the 4553, you can put the 4550 in your code, which is almost exactly the same.&lt;br /&gt;
#fuses HS, NOWDT, NOLVP, NOPROTECT //standard fuses&lt;br /&gt;
&lt;br /&gt;
//these fuses are critical. they assume a 20Mhz oscillator:&lt;br /&gt;
#fuses PLL5     //The USB module must run at 48Mhz. This tells the PIC to take the oscillator, divide the frequency by 5, then multiply by 12. The result must be 48Mhz. &lt;br /&gt;
#fuses HSPLL    //I&amp;#039;m not exactly sure what this fuses does, but it&amp;#039;s probably necessary.&lt;br /&gt;
#fuses VREGEN   //The USB module must run at 3.3V. This tells the PIC to accomplish this by using an internal voltage regulator.&lt;br /&gt;
#fuses CPUDIV1  //This tells the PIC to run at a frequency of 48Mhz / 1 = 48Mhz. It may or may not be necessary.&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt;usb_cdc.h&amp;gt; //Include the CCS USB library. If you want to see all the functions available look at usb_cdc.h and usb.h.&lt;br /&gt;
&lt;br /&gt;
void main() {&lt;br /&gt;
   int c;&lt;br /&gt;
&lt;br /&gt;
   //these lines do some initialization, obviously:&lt;br /&gt;
   usb_cdc_init();&lt;br /&gt;
   usb_init();&lt;br /&gt;
&lt;br /&gt;
   while(true) {&lt;br /&gt;
       usb_task(); //handles connections to and disconnections from the computer, registering the PIC with the computer, etc. call this pretty often so that the PIC responds to being plugged in. &lt;br /&gt;
       &lt;br /&gt;
       if(usb_cdc_kbhit()) { //did we get some incoming data? &lt;br /&gt;
           c = usb_cdc_getc(); //get one character of input&lt;br /&gt;
           printf(usb_cdc_putc, &amp;quot;you typed: %c\r\n&amp;quot;, c); //print out a response over usb&lt;br /&gt;
       }&lt;br /&gt;
   }&lt;br /&gt;
}[/code]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
CCS also has an example where the PIC registers itself as a Human Interface Device (HID). USB mice and keyboards use HID. The advantage of this is that doesn&amp;#039;t require the user to install a special driver. The disadvantages are (a) the connection doesn&amp;#039;t look like a simple RS232 link and (b) bandwidth is limited. A HID can only send messages to the computer once every millisecond, and can only send 64 bytes in each message, so the maximum data transfer rate is 64K bytes/second. In theory, unfettered USB can go up to 12M bits/second, so HID is fairly slow in comparison. &lt;br /&gt;
&lt;br /&gt;
Microchip provides a USB framework for use with its [[C18 compiler]]. &lt;br /&gt;
&lt;br /&gt;
It&amp;#039;s also possible to create one&amp;#039;s own setup from scratch or by modifying a preexisting library. This probably takes some effort.&lt;/div&gt;</summary>
		<author><name>Kwang Sim</name></author>
	</entry>
	<entry>
		<id>https://hades.mech.northwestern.edu//index.php?title=File:USBConnectors.jpg&amp;diff=13055</id>
		<title>File:USBConnectors.jpg</title>
		<link rel="alternate" type="text/html" href="https://hades.mech.northwestern.edu//index.php?title=File:USBConnectors.jpg&amp;diff=13055"/>
		<updated>2009-04-20T20:54:40Z</updated>

		<summary type="html">&lt;p&gt;Kwang Sim: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Kwang Sim</name></author>
	</entry>
	<entry>
		<id>https://hades.mech.northwestern.edu//index.php?title=File:USB.svg&amp;diff=13054</id>
		<title>File:USB.svg</title>
		<link rel="alternate" type="text/html" href="https://hades.mech.northwestern.edu//index.php?title=File:USB.svg&amp;diff=13054"/>
		<updated>2009-04-20T20:53:20Z</updated>

		<summary type="html">&lt;p&gt;Kwang Sim: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Kwang Sim</name></author>
	</entry>
	<entry>
		<id>https://hades.mech.northwestern.edu//index.php?title=Main_Page&amp;diff=13053</id>
		<title>Main Page</title>
		<link rel="alternate" type="text/html" href="https://hades.mech.northwestern.edu//index.php?title=Main_Page&amp;diff=13053"/>
		<updated>2009-04-20T20:47:05Z</updated>

		<summary type="html">&lt;p&gt;Kwang Sim: by Greg McGlynn&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The Northwestern University mechatronics design wiki provides reference material on the theory and applications of electronics, sensors, actuators, etc., for use in mechatronics-related research and projects.  Practical applications often refer to equipment and supplies available in the [http://mechatronics.mech.northwestern.edu/ Northwestern Mechatronics Design Lab].&lt;br /&gt;
&lt;br /&gt;
The mechatronics wiki was initiated by undergraduate Ben Stephens in 2006, under the supervision of Profs. Kevin Lynch and Michael Peshkin.  Since then, many students have contributed content.&lt;br /&gt;
&lt;br /&gt;
Important:  Please be sure to read the [http://mechatronics.mech.northwestern.edu/mech-rules.pdf Rules for Using the Mechatronics Design Lab].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h3&amp;gt;Design Competition 2008&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Wiki pages on sensors, actuators, programming, and microcontrollers: use pages below&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
* [http://www.mech.northwestern.edu/courses/433/Writeups/QuickStart/ Parts in the DC2008 quick start pack]&lt;br /&gt;
* [http://peshkin.mech.northwestern.edu/pic/info/piccintro_2008-01-24.pdf PIC C intro slides, as presented 2008/01/24 (pdf)]&lt;br /&gt;
* [http://peshkin.mech.northwestern.edu/pic/info/picinterfacing_2008-01-28.pdf PIC interfacing slides, as presented 2008/01/28 (pdf)]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h3&amp;gt;Sensors and actuators for DC&amp;lt;/h3&amp;gt;&lt;br /&gt;
* [[Using Solderless Breadboard|Solderless Breadboard &amp;amp; wiring that works]]&lt;br /&gt;
* [[Using LEDs &amp;amp; IREDs]]&lt;br /&gt;
* [[Using a laser]]&lt;br /&gt;
* [[Sensing optical tape|Infrared reflectivity]]&lt;br /&gt;
** Using phototransistors&lt;br /&gt;
** Sensing optical tape&lt;br /&gt;
* [[Comparators | Comparators : the analog digital interface]]&lt;br /&gt;
* [http://www.robotroom.com/FaulhaberGearmotor.html Faulhaber MiniMotor SA gearmotor with encoder], as well as [[Actuators_Available_in_the_Mechatronics_Lab#Faulhaber_1524E006S_motor_with_141:1_gearhead_and_HES164A_magnetic_quadrature_encoder|the local wiki page]]&lt;br /&gt;
* [[Adding a magnetic encoder to a GM3 Gearmotor]]&lt;br /&gt;
** Using magnetic switches (Hall Effect)&lt;br /&gt;
* [[High-current devices|Driving high-current devices: several options]]&lt;br /&gt;
* [[Driving a Stepper Motor]]&lt;br /&gt;
* [[Driving an RC Servo]]&lt;br /&gt;
* [[Accelerometers]]&lt;br /&gt;
* [[Strain gauges]]&lt;br /&gt;
* [[Using the Basic Stamp Microcontroller|Basic Stamp Microcontroller]] &amp;lt;b&amp;gt;Not recommended for DC2008&amp;lt;/b&amp;gt;&lt;br /&gt;
* [http://www.mech.northwestern.edu/courses/433/Writeups/Battery_NiMH/ NiMH rechargable batteries and chargers]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h3&amp;gt; [http://peshkin.mech.northwestern.edu/datasheets Prof. Peshkin&amp;#039;s favorite datasheets]&amp;lt;/h3&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h3&amp;gt;PIC 18F4520 prototyping board &amp;lt;/h3&amp;gt;&lt;br /&gt;
*[[4520 Board intro|Prototyping board intro]]&lt;br /&gt;
*[[4520 Board construction|Assembling the 18F4520 prototyping board, circuit, parts]]&lt;br /&gt;
*[[4520 Board use|Using the 18F4520 prototyping board]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h3&amp;gt;Programming with CCS C &amp;lt;/h3&amp;gt;&lt;br /&gt;
*[[C language|The C language]]&lt;br /&gt;
*[[CCS C|CCS C, specifically for the 18F4520]]&lt;br /&gt;
*[[Embedded Programming Tips for CCS C]]&lt;br /&gt;
*[[CCS IDE|Using the CCS development environment]]&lt;br /&gt;
*[[Debugging C on a PIC]]&lt;br /&gt;
*[[More debugging tips]]&lt;br /&gt;
*[http://www.ccsinfo.com/forum/ CCS user forum]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h3&amp;gt;Interfacing and skeleton code for the PIC 18F4520&amp;lt;/h3&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;These topics have wiki pages &amp;lt;i&amp;gt;and&amp;lt;/i&amp;gt; sample code available&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;[http://peshkin.mech.northwestern.edu/pic/code Link to all sample code here.]&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
* [[Digital inputs &amp;amp; outputs]] (filename: DigitalIO)&lt;br /&gt;
* [[Analog Input]] (filename: AnalogInput)&lt;br /&gt;
** reading a trimpot&lt;br /&gt;
** reading a phototransistor&lt;br /&gt;
** amplified phototransistor, and IRED strobing&lt;br /&gt;
** using an instrumentation amp (example: for a strain gauge)&lt;br /&gt;
* [[Analog Output|Analog Output, and the I2C bus]] (filename: AnalogOutput)&lt;br /&gt;
* [[Waveform Generation with AD9833]] (filename: AD9833)&lt;br /&gt;
* [[SPI - Serial Peripheral Interface - on the PIC]]&lt;br /&gt;
*[[Pulse width modulation|Pulse width modulation (PWM) for driving motors or other high current devices]] (filename: MotorPWM)&lt;br /&gt;
** using H-bridges&lt;br /&gt;
* [[Interrupts]]&lt;br /&gt;
* [[Quadrature decoding in software]] (filename: QuadratureSoft)&lt;br /&gt;
* [[Quadrature decoding in hardware, or just counters]] (filename: QuadratureHard)&lt;br /&gt;
* [[Running RC servos]] (filename: RCservoSoft &amp;amp; RCservoHard)&lt;br /&gt;
* [[Watchdog timer]] (filename: Watchdog)&lt;br /&gt;
* [[PIC RS232|RS-232 serial communication between a PC and a PIC]] (filename: RS232)&lt;br /&gt;
* [[C Example: Serial LCD|Text output to a serial LCD display]]&lt;br /&gt;
* [[C Example: Parallel Interfacing with LCDs|Text output to a parallel LCD display]]&lt;br /&gt;
* [[Servo skeleton with fast &amp;amp; slow interrupts]]&lt;br /&gt;
* [[XBee radio communication between PICs]] (and between a PC and a PIC)&lt;br /&gt;
* [[I2C communication between PICs]]&lt;br /&gt;
* [[Serial communication with Matlab]]&lt;br /&gt;
* [[SPI communication between PICs]] &amp;lt;b&amp;gt; (Note:  this function has not been successfully tested)&amp;lt;/b&amp;gt;&lt;br /&gt;
* [[USB communication with PC]]&lt;br /&gt;
* [[Microphones]]&lt;br /&gt;
* [[Ambient light color sensing]]&lt;br /&gt;
* [[Controlling a seven segment display]]&lt;br /&gt;
* [[Storing constant data in program memory]]&lt;br /&gt;
* [[PIC computation time benchmarks]]&lt;br /&gt;
* [[Stepper motor control with the PIC]]&lt;br /&gt;
* [[Global Positioning System]]&lt;br /&gt;
* [[IR communication between PICs]] &amp;lt;b&amp;gt; (Note:  this function has not been successfully tested) &amp;lt;/b&amp;gt;&lt;br /&gt;
* [[Interfacing to External EEPROM]]&lt;br /&gt;
* [[I2C Motor Controller]]&lt;br /&gt;
* [[Interfacing with a Photodiode Array]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;These topics have sample code available, but no wiki pages yet&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;[http://peshkin.mech.northwestern.edu/pic/code Link to all sample code here.]&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Counter0 - Counting pulses with Timer0]&lt;br /&gt;
* Counter1 - Counting pulses with Timer1]&lt;br /&gt;
* Interrupt0 - Periodic servo cycles using interrupt routines, 10mS &amp;amp; slower; Timer 0]&lt;br /&gt;
* Interrupt2 - Periodic servo cycles using interrupt routines; 10mS &amp;amp; faster; Timer 2]&lt;br /&gt;
* InterruptExternal - Interrupts generated by an external pulse]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;These topics need more development&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;[http://peshkin.mech.northwestern.edu/pic/code Link to all sample code here.]&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* AnalogOutputParallel - Analog output using 8 digital lines]&lt;br /&gt;
* PIC-to-PIC communication &lt;br /&gt;
* Zigbee radio communication&lt;br /&gt;
* Modulated IR communication&lt;br /&gt;
* Strobing LEDs or IREDs for better range and immunity to background light&lt;br /&gt;
* I2C communication &lt;br /&gt;
* CAN bus&lt;br /&gt;
* Capturing data to Matlab&lt;br /&gt;
* Running stepper motors&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h3&amp;gt;PIC Microcontrollers&amp;lt;/h3&amp;gt;&lt;br /&gt;
* [[PIC Microcontrollers with CCS Compiler]], for DC, 333, etc, using the CCS ICD-U40 device &amp;lt;b&amp;gt;[this section has been replaced by the material above]&amp;lt;/b&amp;gt;&lt;br /&gt;
* [[PIC Microcontrollers with C18 Compiler]], for e-puck, or using the Microchip ICD device or&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h3&amp;gt;e-puck Mobile Robot&amp;lt;/h3&amp;gt;&lt;br /&gt;
* [[e-puck Mobile Robot]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h3&amp;gt;[[Printing Circuit Boards]]&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [[PCB Artist | PCB Artist: Software provided by Advanced Circuits]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h3&amp;gt; Electronics &amp;lt;/h3&amp;gt;&lt;br /&gt;
* [http://hades.mech.northwestern.edu/wiki/index.php/Category:Electronics Electronics]&lt;br /&gt;
* [[Phase-Sensitive Detection]]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Operational_amplifier_applications Op-Amp Applications]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h3&amp;gt;Analog and Digital chips&amp;lt;/h3&amp;gt;&lt;br /&gt;
* [[Comparators | Comparators: the analog to digital interface]]&lt;br /&gt;
* [[Filtering with the LMF100 | Filtering with the LMF100]]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Operational_amplifier_applications Opamps : building blocks of analog computation]&lt;br /&gt;
* [http://www.mech.northwestern.edu/courses/433/Writeups/InstAmp/instamp.htm Instrumentation amps, and NU circuit board for them]&lt;br /&gt;
* [[LED Drivers | Controlling large numbers of LEDs with LED drivers]]&lt;br /&gt;
* [[Opto-isolators | Opto-isolators: Signal transfer while electrically isolating circuits]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h3&amp;gt;[[:Category:Sensors|Sensors]]&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [[Potentiometers|Angle, Linear Position: Potentiometers]]&lt;br /&gt;
* [[Optointerrupter|Beam Breaker: Optointerrupter]]&lt;br /&gt;
* [[Optoreflector|Proximity: Optoreflector]]&lt;br /&gt;
* [[Sensing optical tape|Infrared reflectivity : Sensing optical tape]]&lt;br /&gt;
* [[Reed Switch|Proximity: Reed Switch]]&lt;br /&gt;
* [[Hall Effect Sensor|Proximity, Angle: Hall Effect Sensor]]&lt;br /&gt;
* [[Rotary Encoder|Angle: Rotary Encoder]]&lt;br /&gt;
* Angular Velocity: Tachometer&lt;br /&gt;
* [[Photodiodes and Phototransistors|Light: Photodiodes and Phototransistors]]&lt;br /&gt;
* [[Photocell|Ambient Light: Photocell]]&lt;br /&gt;
* [[Thermistor|Temperature: Thermistor]]&lt;br /&gt;
* Temperature: Thermotransistor IC&lt;br /&gt;
* Audio: [[Microphones]]&lt;br /&gt;
* [[Accelerometers|Tilt, Acceleration: Accelerometers]]&lt;br /&gt;
* [[Strain Gauge|Force: Strain Gauge]]&lt;br /&gt;
* Current: Current Sense Resistor&lt;br /&gt;
* [[Limit Switch|Contact: Microswitch (Limit Switch)]]&lt;br /&gt;
* [[Ambient light color sensing]]&lt;br /&gt;
* [[Global Positioning System]]&lt;br /&gt;
* [[Optics]]&lt;br /&gt;
* [[Optical Locating]]&lt;br /&gt;
* [[Lateral-Effect Photodiode]]&lt;br /&gt;
* [[IR Target Illumination|IRED&amp;#039;s]]&lt;br /&gt;
* [[Pressure Sensing]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h3&amp;gt;[[:Category:Actuators|Actuators]]&amp;lt;/h3&amp;gt;&lt;br /&gt;
[[image:All-actuators-captions-small.jpg|thumb|300px|[[Actuators Available in the Mechatronics Lab|Some of the available actuators]]|right]]&lt;br /&gt;
&lt;br /&gt;
* [[Brushed DC Motor Theory|Brushed DC Motors]]&lt;br /&gt;
** [[Choosing a Motor and Gearing Combination|Choosing a Motor and Gearing Combination]]&lt;br /&gt;
** [[Linear Amplifier Motor Driver|Driving Using a Linear Amplifier]]&lt;br /&gt;
** [[Driving using a single MOSFET|Driving using a single MOSFET]]&lt;br /&gt;
** [[Pulse Width Modulation|Driving Using Pulse Width Modulation]]&lt;br /&gt;
** [[PIC PWM Motor Driver]]&lt;br /&gt;
** [[Gear Motor]]&lt;br /&gt;
** [[Pulse Width Modulation]]&lt;br /&gt;
** [[Pulse_width_modulation]]&lt;br /&gt;
** [[Driving using a single MOSFET | Driving a DC motor using a single MOSFET]]&lt;br /&gt;
** [[Driving a DC Motor using PWM]]&lt;br /&gt;
** [[Driving a high current DC Motor using an H-bridge]]&lt;br /&gt;
** [http://www.mech.northwestern.edu/courses/433/Writeups/AddEncoderHobbyEngGearMotor Adding a rotation encoder to a gearmotor]&lt;br /&gt;
** [[Using Opto-Isolators to Prevent Interference]]&lt;br /&gt;
* [[Brushless DC Motors]]&lt;br /&gt;
** [[Driving Brushless DC Motors]]&lt;br /&gt;
* [[Stepper Motor Theory|Stepper Motors]]&lt;br /&gt;
** [[Stepper Motor Circuits|Driving Stepper Motors]]&lt;br /&gt;
** [[Unipolar Stepper Motor Driver Circuit]]&lt;br /&gt;
** [[Bipolar Stepper Motor Driver Circuit]]&lt;br /&gt;
* [[RC Servo Theory|RC Servos]]&lt;br /&gt;
** [[555 Servo Circuit|Driving Your Servo Using a 555 Timer]]&lt;br /&gt;
* [[Solenoid Theory|Solenoids]]&lt;br /&gt;
** Practice: Driving Your Solenoid&lt;br /&gt;
* AC Motors&lt;br /&gt;
** [[Using the Yaskawa Motors]]&lt;br /&gt;
* [[Fans As Actuators|Fans As Actuators]]&lt;br /&gt;
* [[LIMS Air Hockey Table|LIMS Air Hockey Table]]&lt;br /&gt;
* [[Actuators Available in the Mechatronics Lab]]&lt;br /&gt;
&amp;lt;br clear=all/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h3&amp;gt;Mechanical Design&amp;lt;/h3&amp;gt;&lt;br /&gt;
*Mechanics of Materials&lt;br /&gt;
**Beam Mechanics&lt;br /&gt;
**[[Mohr&amp;#039;s Circle]]&lt;br /&gt;
*Failure Theories&lt;br /&gt;
**Static Loading&lt;br /&gt;
**Variable Loading and Fatigue&lt;br /&gt;
*[[Attaching to a shaft]]&lt;br /&gt;
*Support&lt;br /&gt;
**Housings&lt;br /&gt;
**Shafts&lt;br /&gt;
**[[Bearings]]&lt;br /&gt;
*Transmission&lt;br /&gt;
**Rigid: [[Gears]]&lt;br /&gt;
**Flexible: Belts, Chains&lt;br /&gt;
**Motion Connection/Separation: Clutches, Brakes, Couplings&lt;br /&gt;
*Linkages&lt;br /&gt;
**Serial Chains&lt;br /&gt;
**Parallel and Closed-Loop Chains&lt;br /&gt;
*Other: springs/dampers, cams, etc.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h3&amp;gt;The PC/104 Stack&amp;lt;/h3&amp;gt;&lt;br /&gt;
[[Image:Img0174.jpg|thumb|300px|[[PC104 Overview|The PC104 Stack]]|right]]&lt;br /&gt;
* [[PC104 Overview|Overview]]&lt;br /&gt;
* [[The PC/104 Lab Kit]]&lt;br /&gt;
* Hardware:&lt;br /&gt;
** [[Advantech CPU Card]]&lt;br /&gt;
** [[Sensoray 526 Data Aquisition Card]]&lt;br /&gt;
&lt;br /&gt;
** [http://www.mech.northwestern.edu/courses/433/Writeups/PC104BoB/stack.htm#power[Power Components]]&lt;br /&gt;
** [http://www.mech.northwestern.edu/courses/433/Writeups/PC104BoB/stack.htm#electrical[I/O Electronics: Analog I/O, Digital I/O, Encoder Connections]]&lt;br /&gt;
* Advanced: Creating a Working Stack from Parts&lt;br /&gt;
** [http://www.mech.northwestern.edu/courses/433/Writeups/PC104BoB/stack.htm [Building the Breakout Board]]&lt;br /&gt;
** [http://www.mech.northwestern.edu/courses/433/Writeups/PC104BoB/stack.htm#ribboncables[Breakout Board Ribbon Cables]]&lt;br /&gt;
** [http://www.mech.northwestern.edu/courses/433/Writeups/PC104BoB/stack.htm#mechanical[Assembling the PC104 Stack]]&lt;br /&gt;
** &amp;#039;&amp;#039;&amp;#039;[[Creating an xPC Flash Boot Disk]]&amp;#039;&amp;#039;&amp;#039; &amp;lt;- when new version of MATLAB&lt;br /&gt;
* Custom Boards&lt;br /&gt;
** Dual PWM Motor Controller&lt;br /&gt;
** Dual Linear Amplifier Motor Controller&lt;br /&gt;
&amp;lt;br clear=all/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h3&amp;gt;xPC Target Real-Time Operating System&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [[xPC Overview|Overview of Real-Time Programming with Simulink and xPC Target]]&lt;br /&gt;
* [[Configuring xPC Target PC|Configuring xPC Host/Target PC]]&lt;br /&gt;
* [[Creating a Simple xPC Program|&amp;#039;&amp;#039;&amp;#039;Quickstart&amp;#039;&amp;#039;&amp;#039;:Creating a simple xPC Program]]&lt;br /&gt;
* [[Common xPC Blocks|Commonly Used Blocks]]&lt;br /&gt;
* [[Using the Host Scope]]&lt;br /&gt;
*Advanced&lt;br /&gt;
** Model Properties&lt;br /&gt;
** [[XPC M-file Communication|M-file communication]]&lt;br /&gt;
** Using outside of the lab&lt;br /&gt;
** [[media:standalone.pdf|Standalone Mode]]&lt;br /&gt;
** Stateflow&lt;br /&gt;
* Code Examples&lt;br /&gt;
** [[Controlling a DC Motor with an Encoder]]&lt;br /&gt;
** Something With State Machine&lt;br /&gt;
** [[Using RS-232 and Printing to LCD]]&lt;br /&gt;
**[[UDP Communications between Target and Host PC]]&lt;br /&gt;
** M-functions and S-functions&lt;br /&gt;
** [[xPC Code From Student Projects]]&lt;br /&gt;
&amp;lt;br clear=all/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h3&amp;gt;QNX Real-Time Operating System&amp;lt;/h3&amp;gt;&lt;br /&gt;
*[[media:qnxtemplate.zip|QNX Control Program with Interrupts]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h3&amp;gt;Lab Supplies and Data Sheets&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [http://spreadsheets.google.com/pub?key=pa_bNAhFF-OvvxpSje1KDYg&amp;amp;output=html&amp;amp;gid=0&amp;amp;single=true Generally stocked lab inventory ]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h3&amp;gt;[[Vendors and Useful Links]]&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h3&amp;gt;Other Software&amp;lt;/h3&amp;gt;&lt;br /&gt;
*[[List of Useful Software for Download]]&lt;br /&gt;
*Circuit Schematics and PCB Layout&lt;br /&gt;
*LaTex Document Preparation&lt;br /&gt;
** [http://meta.wikimedia.org/wiki/Help:Formula Mathematical Formulae]&lt;br /&gt;
** Document Formatting&lt;br /&gt;
** [[LaTeX Software Setup|Software Setup]]&lt;br /&gt;
** IEEE Styles&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h3&amp;gt;[[Other Lab Equipment]]&amp;lt;/h3&amp;gt;&lt;br /&gt;
* Prototyping Tools&lt;br /&gt;
** [[Tektronix TDS220 Oscilloscope]]&lt;br /&gt;
** [[Tektronix CFG253 Function Generator]]&lt;br /&gt;
** [[media:Mastech_power_supply_manual.pdf|Mastech Power Supply]]&lt;br /&gt;
** Fluke III Multimeter&lt;br /&gt;
** Benchtop Multimeter&lt;br /&gt;
** Powered Breadboard&lt;br /&gt;
** Soldering Iron&lt;br /&gt;
* [http://ediacaran.mech.northwestern.edu/neuromech/index.php/Lab_Equipment High Performance Neuromechatronics Benches]&lt;br /&gt;
* The Sensoray 626 DAQ Card&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h3&amp;gt;Course Material&amp;lt;/h3&amp;gt;&lt;br /&gt;
* [[ME 224 Experimental Engineering]]&lt;br /&gt;
* [http://lims.mech.northwestern.edu/~lynch/courses/ME333/2009/index.html ME 333 Introduction to Mechatronics]&lt;br /&gt;
** [[ME 333 Lab Kits]]&lt;br /&gt;
** [[Lab 5]]&lt;br /&gt;
** [[Suggested final projects]]&lt;br /&gt;
** [[ME 333 final projects]]&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* [http://www.mech.northwestern.edu/hartmann/ME333_CourseInformation.html ME 333 Mechatronics]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
* [http://www.mech.northwestern.edu/courses/433/ ME 433 Advanced Mechatronics] &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h3&amp;gt;Miscellaneous&amp;lt;/h3&amp;gt;&lt;br /&gt;
* [[Swarm Robot Project Documentation]]&lt;br /&gt;
&lt;br /&gt;
* [[Machine Vision Localization System]]&lt;br /&gt;
* [[Indoor Localization System | Indoor Localization System (Obsolete)]]&lt;br /&gt;
* [[Robot Helicopter Project]]&lt;br /&gt;
* [[E-Puck Color Sensing Project]]&lt;br /&gt;
* [[Guitar Tunning Project]]&lt;br /&gt;
* [[Swarm Robot Project]]&lt;/div&gt;</summary>
		<author><name>Kwang Sim</name></author>
	</entry>
	<entry>
		<id>https://hades.mech.northwestern.edu//index.php?title=ME_333_final_projects&amp;diff=12991</id>
		<title>ME 333 final projects</title>
		<link rel="alternate" type="text/html" href="https://hades.mech.northwestern.edu//index.php?title=ME_333_final_projects&amp;diff=12991"/>
		<updated>2009-03-20T15:07:09Z</updated>

		<summary type="html">&lt;p&gt;Kwang Sim: /* Persistence-of-Vision Display */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;See the &amp;#039;&amp;#039;&amp;#039;[[ME 333 end of course schedule]]&amp;#039;&amp;#039;&amp;#039;.  &lt;br /&gt;
&lt;br /&gt;
Final projects for ME 333 in years 2000-2007 can be found&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;[http://lims.mech.northwestern.edu/~design/mechatronics/ here]&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== ME 333 Final Projects 2009 ==&lt;br /&gt;
&lt;br /&gt;
=== [[Mozart&amp;#039;s Right Hand]] ===&lt;br /&gt;
[[Image:mrh_box.JPG|thumb|150px|Mozart&amp;#039;s Right Hand|right]]&lt;br /&gt;
Mozart&amp;#039;s Right Hand is a musical instrument capable of playing two full octaves of the [http://en.wikipedia.org/wiki/Diatonic_scale Diatonic Scale.]  The user wears a glove on his right hand and uses motions of the hand and fingers to create different notes that are played with a speaker.  The pitch of the note is controlled by the orientation of the user&amp;#039;s hand as he rotates it ether from the wrist, the elbow, or the shoulder.  The LCD on the front of the box tells the user the pitch that corresponds to his or her current hand orientation.  When the user touches together his thumb and index finger, the speaker plays the tone.  A [http://www.youtube.com/watch?v=vec-W4QeHQU video] of Mozart&amp;#039;s Right Hand in action is available on YouTube.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== [[Persistence-of-Vision Display]] ===&lt;br /&gt;
[[Image:Persistence of Vison Display|right|thumb|150px]]&lt;br /&gt;
This is a fully customizable display implemented using the concept of Persistence of Vision. User-specified images (and even moving images) were displayed by rotating a column of LEDs at speeds faster than 300rpm. Each individual LED was modeled as a row of pixels. Conversely, the rotational position of the panel of LEDs represented the pixel columns of the display; the time interval and rotational speed determined the width of the pixel columns. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== [[Rock Paper Scissors Machine]] ===&lt;br /&gt;
[[Image:rps whole thing.JPG|thumb|150px|Rock Paper Scissors Machine|right]]&lt;br /&gt;
A machine that will play a fully functioning, intuitive game of [http://en.wikipedia.org/wiki/Rock-paper-scissors Rock/Paper/Scissors] (abbreviated as RPS) with a user. The machine is represented by a human-like hand, capable of seperate and independant wrist, arm, finger and thumb motion. The players&amp;#039; hand goes into a glove equipped with flex sensors, which wirelessly transmits data to the machine based on what the player chose. The machine then reads this data, randomly chooses a throw of its own, and displays what the machine threw, what the human threw, total win/loss/tie info, and winner/loser both on an [http://en.wikipedia.org/wiki/Lcd LCD] screen and in the form of a thumbs up/down/side motion. Video of the machine in action can be found [http://www.youtube.com/watch?v=xbLNBSTTrcE here.]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== [[Three-speaker Chladni Patterns]] ===&lt;br /&gt;
[[Image:chladni_660hz|right|thumb|150px]]&lt;br /&gt;
This project uses three speakers to generate shapes on a circular aluminum plate depending on which frequency the speakers are playing at. Once the speakers hit a resonant frequency of the plate, salt migrates to the nodes (zero amplitude) regions of the plate to form distinct patterns.&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== [[Basketball]] ===&lt;br /&gt;
[[Image:Mechatronics2009Bball|right|thumb|150px]]&lt;br /&gt;
This project consists of a throwing arm propelled by a Pittman motor is mounted on a turntable and throws the ball into the &amp;quot;hoop.&amp;quot; The hoop is wrapped in reflective tape and an IR emitter, receiver pair is used to sense where the IR is reflected most (the hoop with highly reflective tape). An ultrasonic sensor then pings the hoop for the distance of the hoop. With this information, the arm is able to &amp;quot;make a basket.&amp;quot; A video can be found [http://www.youtube.com/watch?v=Y466dzP-qiY here].&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== [[Robot Drummer]] ===&lt;br /&gt;
[[Image:Robot_Drummer.jpg|thumb|400pix|right|Robot Drummer]]&lt;br /&gt;
The Robot Drummer is a device that demonstrates high-speed motor control by being able to drum when given commands.  Through an RS232 cable, Matlab sends commands to a &amp;quot;master&amp;quot; PIC.  The master then sends the commands to two &amp;quot;slave&amp;quot; PICs through I2C communication.  The slaves take the commands and implement PID control of the motors.&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== [[Automated Fish Refuge]] ===&lt;br /&gt;
[[Image:Entire Fish Refuge|right|thumb|200px]]&lt;br /&gt;
The automated fish refuge allows for the controlled movement of a fish refuge with the goal of recording specific behavior.  The mechanical design is completely adjustable and allows adjustable degrees of oscillating movement and orientation of the refuge.  The program is primarily in MATLAB for ease of use and the velocity profile can be a sine, square, triangle, or any function that the user inputs. [http://www.youtube.com/watch?v=wGOKujMhN88 Check out the video!]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== [[Marionette]] ===&lt;br /&gt;
[[Image: MarionettePicForIntro.JPG|right|thumb]] The Marionette Project focused on using RC Servos to make a puppet that would do a dance with the press of a button.  There were 5 different dances programmed for the marionette, showcasing different styles of movement.  The movement had 2 degrees of freedom thanks to using 5 bar linkages and 2 RC servos for each arm.  Two more RC Servos were used on the back of the marionette to create the appearance of leg movement.  The movements included a Hula dance, Jumping Jacks, and even some moves right out of Saturday Night Fever.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== [[Monkeybot]] ===&lt;br /&gt;
[[Image:monkeybot_pic|thumb|right|200px|Moneybot]]&lt;br /&gt;
The monkeybot, is a swinging robot capable of moving side to side and climbing.  It consists of a two link, double pendulum system with an electro-magnet on each end.  At the pivot is a DC motor, which provides an input torque and allows the swinging system to gain energy and climb.  Check out the video of the monkeybot climbing [http://www.youtube.com/watch?v=TA2VcH_GDJ0 here].   &lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== [[PPOD-mini:  6-DOF Shaker]] ===&lt;br /&gt;
[[Image:PPOD_mini.JPG|thumb|200x200 px|right|PPOD-mini 6-DOF Shaker]]&lt;br /&gt;
The PPOD-mini is a miniaturized version of the Programmable Part-feeding Oscillatory Device ([http://lims.mech.northwestern.edu/projects/frictioninducedforcefields/index.htm PPOD]) found in the Laboratory for Intelligent Mechanical Systems (LIMS) at Northwestern. The PPOD-mini utilizes six speakers that act like actuators. The speakers are connected to a acrylic plate via flexures of tygon and iron. In its current implementation, the phase of the speakers can be controlled independently, giving the device six degrees of freedom. The movement of objects placed on the acrylic plate can be controlled by changing the phases of the speakers.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== [[Automated Xylophone]] ===&lt;br /&gt;
[[Image:AutomatedXylophonePicture1.jpg|thumb|200x200 px|right|Automated Xylophone]]&lt;br /&gt;
The Automated Xylophone controls several solenoids which hit various pitches on an actual xylophone based on the note selected.  The device has two main modes: using the keypad, a user can choose to either play notes in real time or store songs to be played back later.  A video of the Automated Xylophone playing in real time mode can be found [http://www.youtube.com/watch?v=_ubpAEyq9kg here].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== [[Vision-based Cannon]] ===&lt;br /&gt;
[[Image:SM_Gun_Camera_PIC_Setup.JPG|thumb|200x200 px|right|Vision-based Cannon]]&lt;br /&gt;
This project uses a webcam and Matlab to analyze an image and direct a modified USB Missile Launcher to fire at targets found in the image.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== ME 333 Final Projects 2008 ==&lt;br /&gt;
&lt;br /&gt;
=== [[IR Tracker]] ===&lt;br /&gt;
&lt;br /&gt;
[[Image:IR_Tracker_Main.jpg|right|thumb|200px]]&lt;br /&gt;
&lt;br /&gt;
The IR Tracker (aka &amp;quot;Spot&amp;quot;) is a device that follows a moving infrared light. It continuously detects the position of an infrared emitter in two axes, and then tracks the emitter with a laser. [[Media:MT_MS_AZ_TrackerVideo.mp4|See Spot Run.]]&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Chosen the OUTSTANDING PROJECT by the students of ME 333.&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== [[Robot Snake]] ===&lt;br /&gt;
[[Image:HLSSnakeMain.jpg|right|thumb|200px]]&lt;br /&gt;
&lt;br /&gt;
This remote control robotic snake uses servo motors with a traveling sine wave motion profile to mimic serpentine motion.  The robotic snake is capable of moving forward, left, right and in reverse.   &lt;br /&gt;
[http://www.youtube.com/watch?v=r_GOOFLnI6w Video of the robot snake]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== [[Programmable Stiffness Joint]] === &lt;br /&gt;
&lt;br /&gt;
[[Image:SteelToePic2.jpg|thumb|200px|The &amp;#039;Steel Toe&amp;#039; programmable stiffness joint|right]]&lt;br /&gt;
&lt;br /&gt;
The Programmable Stiffness Joint varies rotational stiffness as desired by the user.  It is the first step in modeling the mechanical impedance of the human ankle joint (both stiffness and damping) for the purpose of determining the respective breakdown of the two properties over the gait cycle.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== [[Magnetic based sample purification]] ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== [[Continuously Variable Transmission]] ===&lt;br /&gt;
&lt;br /&gt;
[[image:CVT_system.JPG|thumb|200px]]&lt;br /&gt;
&lt;br /&gt;
This prototype is a proof of concept model of a variable ratio transmission to be implemented in the 2008-2009 Formula SAE competition vehicle.  The gear ratio is determined by the distances between the pulley halves which are controllable electronically.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== [[Granular Flow Rotating Sphere]] ===&lt;br /&gt;
[[Image:Team-21-main-picture.JPG|right|thumb|200px]]&lt;br /&gt;
This device will be used to study the granular flow of particles within a rotating sphere. The sphere is filled with grains of varying size and then rotated about two different axes according to a series of position and angular velocity inputs.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== [[Vibratory Clock]] ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Vibratory_Clock.jpg|right|thumb|Vibratory Clock|200px]]&lt;br /&gt;
&lt;br /&gt;
The Vibratory Clock allows a small object to act as an hour &amp;quot;hand&amp;quot; on a horizontal circular platform that is actuated from underneath by three speakers.  The object slides around the circular platform, impelled by friction forces due to the vibration.  [http://www.youtube.com/watch?v=KhgTNCfdwZw Check it out!]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== [[WiiMouse]] ===&lt;br /&gt;
&lt;br /&gt;
[[Image:HPIM1027.jpg|right|thumb|200px]]&lt;br /&gt;
&lt;br /&gt;
The WiiMouse is a handheld remote that can be used to move a cursor on a windows-based PC, via accelerometer input captured through device movement.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== [[Intelligent Oscillation Controller]] ===&lt;br /&gt;
&lt;br /&gt;
[[image:ME333_learning_oscillator.jpg|thumb|200px]]&lt;br /&gt;
&lt;br /&gt;
This device &amp;quot;learns&amp;quot; a forcing function that is applied to a spring and mass system to match an arbitrary, periodic acceleration profile.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== [[Baseball]] ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Baseball_Playfield.jpg|Sweet Baseball Game|right|thumb|200px]]&lt;br /&gt;
&lt;br /&gt;
An interactive baseball game inspired by pinball, featuring pitching, batting, light up bases and a scoreboard to keep track of the game.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== [[Ball Balancing Challenge]] ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Ballbalancechallenge.JPG|right|thumb|200px]]&lt;br /&gt;
&lt;br /&gt;
An interactive game involving ball balancing on a touchscreen with touchscreen feedback and joystick action. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;/div&gt;</summary>
		<author><name>Kwang Sim</name></author>
	</entry>
	<entry>
		<id>https://hades.mech.northwestern.edu//index.php?title=File:Persistence_of_Vison_Display&amp;diff=12990</id>
		<title>File:Persistence of Vison Display</title>
		<link rel="alternate" type="text/html" href="https://hades.mech.northwestern.edu//index.php?title=File:Persistence_of_Vison_Display&amp;diff=12990"/>
		<updated>2009-03-20T15:00:53Z</updated>

		<summary type="html">&lt;p&gt;Kwang Sim: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Kwang Sim</name></author>
	</entry>
	<entry>
		<id>https://hades.mech.northwestern.edu//index.php?title=ME_333_final_projects&amp;diff=12989</id>
		<title>ME 333 final projects</title>
		<link rel="alternate" type="text/html" href="https://hades.mech.northwestern.edu//index.php?title=ME_333_final_projects&amp;diff=12989"/>
		<updated>2009-03-20T15:00:08Z</updated>

		<summary type="html">&lt;p&gt;Kwang Sim: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;See the &amp;#039;&amp;#039;&amp;#039;[[ME 333 end of course schedule]]&amp;#039;&amp;#039;&amp;#039;.  &lt;br /&gt;
&lt;br /&gt;
Final projects for ME 333 in years 2000-2007 can be found&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;[http://lims.mech.northwestern.edu/~design/mechatronics/ here]&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== ME 333 Final Projects 2009 ==&lt;br /&gt;
&lt;br /&gt;
=== [[Mozart&amp;#039;s Right Hand]] ===&lt;br /&gt;
[[Image:mrh_box.JPG|thumb|150px|Mozart&amp;#039;s Right Hand|right]]&lt;br /&gt;
Mozart&amp;#039;s Right Hand is a musical instrument capable of playing two full octaves of the [http://en.wikipedia.org/wiki/Diatonic_scale Diatonic Scale.]  The user wears a glove on his right hand and uses motions of the hand and fingers to create different notes that are played with a speaker.  The pitch of the note is controlled by the orientation of the user&amp;#039;s hand as he rotates it ether from the wrist, the elbow, or the shoulder.  The LCD on the front of the box tells the user the pitch that corresponds to his or her current hand orientation.  When the user touches together his thumb and index finger, the speaker plays the tone.  A [http://www.youtube.com/watch?v=vec-W4QeHQU video] of Mozart&amp;#039;s Right Hand in action is available on YouTube.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== [[Persistence-of-Vision Display]] ===&lt;br /&gt;
[[Image:Persistence of Vison Display|right|thumb|150px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
=== [[Rock Paper Scissors Machine]] ===&lt;br /&gt;
[[Image:rps whole thing.JPG|thumb|150px|Rock Paper Scissors Machine|right]]&lt;br /&gt;
A machine that will play a fully functioning, intuitive game of [http://en.wikipedia.org/wiki/Rock-paper-scissors Rock/Paper/Scissors] (abbreviated as RPS) with a user. The machine is represented by a human-like hand, capable of seperate and independant wrist, arm, finger and thumb motion. The players&amp;#039; hand goes into a glove equipped with flex sensors, which wirelessly transmits data to the machine based on what the player chose. The machine then reads this data, randomly chooses a throw of its own, and displays what the machine threw, what the human threw, total win/loss/tie info, and winner/loser both on an [http://en.wikipedia.org/wiki/Lcd LCD] screen and in the form of a thumbs up/down/side motion. Video of the machine in action can be found [http://www.youtube.com/watch?v=xbLNBSTTrcE here.]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== [[Three-speaker Chladni Patterns]] ===&lt;br /&gt;
[[Image:chladni_660hz|right|thumb|150px]]&lt;br /&gt;
This project uses three speakers to generate shapes on a circular aluminum plate depending on which frequency the speakers are playing at. Once the speakers hit a resonant frequency of the plate, salt migrates to the nodes (zero amplitude) regions of the plate to form distinct patterns.&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== [[Basketball]] ===&lt;br /&gt;
[[Image:Mechatronics2009Bball|right|thumb|150px]]&lt;br /&gt;
This project consists of a throwing arm propelled by a Pittman motor is mounted on a turntable and throws the ball into the &amp;quot;hoop.&amp;quot; The hoop is wrapped in reflective tape and an IR emitter, receiver pair is used to sense where the IR is reflected most (the hoop with highly reflective tape). An ultrasonic sensor then pings the hoop for the distance of the hoop. With this information, the arm is able to &amp;quot;make a basket.&amp;quot; A video can be found [http://www.youtube.com/watch?v=Y466dzP-qiY here].&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== [[Robot Drummer]] ===&lt;br /&gt;
[[Image:Robot_Drummer.jpg|thumb|400pix|right|Robot Drummer]]&lt;br /&gt;
The Robot Drummer is a device that demonstrates high-speed motor control by being able to drum when given commands.  Through an RS232 cable, Matlab sends commands to a &amp;quot;master&amp;quot; PIC.  The master then sends the commands to two &amp;quot;slave&amp;quot; PICs through I2C communication.  The slaves take the commands and implement PID control of the motors.&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== [[Automated Fish Refuge]] ===&lt;br /&gt;
[[Image:Entire Fish Refuge|right|thumb|200px]]&lt;br /&gt;
The automated fish refuge allows for the controlled movement of a fish refuge with the goal of recording specific behavior.  The mechanical design is completely adjustable and allows adjustable degrees of oscillating movement and orientation of the refuge.  The program is primarily in MATLAB for ease of use and the velocity profile can be a sine, square, triangle, or any function that the user inputs. [http://www.youtube.com/watch?v=wGOKujMhN88 Check out the video!]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== [[Marionette]] ===&lt;br /&gt;
[[Image: MarionettePicForIntro.JPG|right|thumb]] The Marionette Project focused on using RC Servos to make a puppet that would do a dance with the press of a button.  There were 5 different dances programmed for the marionette, showcasing different styles of movement.  The movement had 2 degrees of freedom thanks to using 5 bar linkages and 2 RC servos for each arm.  Two more RC Servos were used on the back of the marionette to create the appearance of leg movement.  The movements included a Hula dance, Jumping Jacks, and even some moves right out of Saturday Night Fever.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== [[Monkeybot]] ===&lt;br /&gt;
[[Image:monkeybot_pic|thumb|right|200px|Moneybot]]&lt;br /&gt;
The monkeybot, is a swinging robot capable of moving side to side and climbing.  It consists of a two link, double pendulum system with an electro-magnet on each end.  At the pivot is a DC motor, which provides an input torque and allows the swinging system to gain energy and climb.  Check out the video of the monkeybot climbing [http://www.youtube.com/watch?v=TA2VcH_GDJ0 here].   &lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== [[PPOD-mini:  6-DOF Shaker]] ===&lt;br /&gt;
[[Image:PPOD_mini.JPG|thumb|200x200 px|right|PPOD-mini 6-DOF Shaker]]&lt;br /&gt;
The PPOD-mini is a miniaturized version of the Programmable Part-feeding Oscillatory Device ([http://lims.mech.northwestern.edu/projects/frictioninducedforcefields/index.htm PPOD]) found in the Laboratory for Intelligent Mechanical Systems (LIMS) at Northwestern. The PPOD-mini utilizes six speakers that act like actuators. The speakers are connected to a acrylic plate via flexures of tygon and iron. In its current implementation, the phase of the speakers can be controlled independently, giving the device six degrees of freedom. The movement of objects placed on the acrylic plate can be controlled by changing the phases of the speakers.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== [[Automated Xylophone]] ===&lt;br /&gt;
[[Image:AutomatedXylophonePicture1.jpg|thumb|200x200 px|right|Automated Xylophone]]&lt;br /&gt;
The Automated Xylophone controls several solenoids which hit various pitches on an actual xylophone based on the note selected.  The device has two main modes: using the keypad, a user can choose to either play notes in real time or store songs to be played back later.  A video of the Automated Xylophone playing in real time mode can be found [http://www.youtube.com/watch?v=_ubpAEyq9kg here].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== [[Vision-based Cannon]] ===&lt;br /&gt;
[[Image:SM_Gun_Camera_PIC_Setup.JPG|thumb|200x200 px|right|Vision-based Cannon]]&lt;br /&gt;
This project uses a webcam and Matlab to analyze an image and direct a modified USB Missile Launcher to fire at targets found in the image.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== ME 333 Final Projects 2008 ==&lt;br /&gt;
&lt;br /&gt;
=== [[IR Tracker]] ===&lt;br /&gt;
&lt;br /&gt;
[[Image:IR_Tracker_Main.jpg|right|thumb|200px]]&lt;br /&gt;
&lt;br /&gt;
The IR Tracker (aka &amp;quot;Spot&amp;quot;) is a device that follows a moving infrared light. It continuously detects the position of an infrared emitter in two axes, and then tracks the emitter with a laser. [[Media:MT_MS_AZ_TrackerVideo.mp4|See Spot Run.]]&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Chosen the OUTSTANDING PROJECT by the students of ME 333.&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== [[Robot Snake]] ===&lt;br /&gt;
[[Image:HLSSnakeMain.jpg|right|thumb|200px]]&lt;br /&gt;
&lt;br /&gt;
This remote control robotic snake uses servo motors with a traveling sine wave motion profile to mimic serpentine motion.  The robotic snake is capable of moving forward, left, right and in reverse.   &lt;br /&gt;
[http://www.youtube.com/watch?v=r_GOOFLnI6w Video of the robot snake]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== [[Programmable Stiffness Joint]] === &lt;br /&gt;
&lt;br /&gt;
[[Image:SteelToePic2.jpg|thumb|200px|The &amp;#039;Steel Toe&amp;#039; programmable stiffness joint|right]]&lt;br /&gt;
&lt;br /&gt;
The Programmable Stiffness Joint varies rotational stiffness as desired by the user.  It is the first step in modeling the mechanical impedance of the human ankle joint (both stiffness and damping) for the purpose of determining the respective breakdown of the two properties over the gait cycle.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== [[Magnetic based sample purification]] ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== [[Continuously Variable Transmission]] ===&lt;br /&gt;
&lt;br /&gt;
[[image:CVT_system.JPG|thumb|200px]]&lt;br /&gt;
&lt;br /&gt;
This prototype is a proof of concept model of a variable ratio transmission to be implemented in the 2008-2009 Formula SAE competition vehicle.  The gear ratio is determined by the distances between the pulley halves which are controllable electronically.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== [[Granular Flow Rotating Sphere]] ===&lt;br /&gt;
[[Image:Team-21-main-picture.JPG|right|thumb|200px]]&lt;br /&gt;
This device will be used to study the granular flow of particles within a rotating sphere. The sphere is filled with grains of varying size and then rotated about two different axes according to a series of position and angular velocity inputs.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== [[Vibratory Clock]] ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Vibratory_Clock.jpg|right|thumb|Vibratory Clock|200px]]&lt;br /&gt;
&lt;br /&gt;
The Vibratory Clock allows a small object to act as an hour &amp;quot;hand&amp;quot; on a horizontal circular platform that is actuated from underneath by three speakers.  The object slides around the circular platform, impelled by friction forces due to the vibration.  [http://www.youtube.com/watch?v=KhgTNCfdwZw Check it out!]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== [[WiiMouse]] ===&lt;br /&gt;
&lt;br /&gt;
[[Image:HPIM1027.jpg|right|thumb|200px]]&lt;br /&gt;
&lt;br /&gt;
The WiiMouse is a handheld remote that can be used to move a cursor on a windows-based PC, via accelerometer input captured through device movement.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== [[Intelligent Oscillation Controller]] ===&lt;br /&gt;
&lt;br /&gt;
[[image:ME333_learning_oscillator.jpg|thumb|200px]]&lt;br /&gt;
&lt;br /&gt;
This device &amp;quot;learns&amp;quot; a forcing function that is applied to a spring and mass system to match an arbitrary, periodic acceleration profile.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== [[Baseball]] ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Baseball_Playfield.jpg|Sweet Baseball Game|right|thumb|200px]]&lt;br /&gt;
&lt;br /&gt;
An interactive baseball game inspired by pinball, featuring pitching, batting, light up bases and a scoreboard to keep track of the game.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== [[Ball Balancing Challenge]] ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Ballbalancechallenge.JPG|right|thumb|200px]]&lt;br /&gt;
&lt;br /&gt;
An interactive game involving ball balancing on a touchscreen with touchscreen feedback and joystick action. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;/div&gt;</summary>
		<author><name>Kwang Sim</name></author>
	</entry>
	<entry>
		<id>https://hades.mech.northwestern.edu//index.php?title=POV-PC.zip&amp;diff=12618</id>
		<title>POV-PC.zip</title>
		<link rel="alternate" type="text/html" href="https://hades.mech.northwestern.edu//index.php?title=POV-PC.zip&amp;diff=12618"/>
		<updated>2009-03-20T03:20:02Z</updated>

		<summary type="html">&lt;p&gt;Kwang Sim: Redirecting to Image:POV-PC.zip&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#REDIRECT [[Image:POV-PC.zip]]&lt;/div&gt;</summary>
		<author><name>Kwang Sim</name></author>
	</entry>
	<entry>
		<id>https://hades.mech.northwestern.edu//index.php?title=POV-PC.zip&amp;diff=12616</id>
		<title>POV-PC.zip</title>
		<link rel="alternate" type="text/html" href="https://hades.mech.northwestern.edu//index.php?title=POV-PC.zip&amp;diff=12616"/>
		<updated>2009-03-20T03:19:30Z</updated>

		<summary type="html">&lt;p&gt;Kwang Sim: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#REDIRECT Image:POV-PC.zip&lt;/div&gt;</summary>
		<author><name>Kwang Sim</name></author>
	</entry>
	<entry>
		<id>https://hades.mech.northwestern.edu//index.php?title=File:POV-PC.zip&amp;diff=12609</id>
		<title>File:POV-PC.zip</title>
		<link rel="alternate" type="text/html" href="https://hades.mech.northwestern.edu//index.php?title=File:POV-PC.zip&amp;diff=12609"/>
		<updated>2009-03-20T03:16:04Z</updated>

		<summary type="html">&lt;p&gt;Kwang Sim: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Kwang Sim</name></author>
	</entry>
	<entry>
		<id>https://hades.mech.northwestern.edu//index.php?title=Persistence-of-Vision_Display&amp;diff=12600</id>
		<title>Persistence-of-Vision Display</title>
		<link rel="alternate" type="text/html" href="https://hades.mech.northwestern.edu//index.php?title=Persistence-of-Vision_Display&amp;diff=12600"/>
		<updated>2009-03-20T03:11:25Z</updated>

		<summary type="html">&lt;p&gt;Kwang Sim: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Overview ==&lt;br /&gt;
[[image:POV|right]]&lt;br /&gt;
A fully customizable display using the concept of Persistence of Vision was created as a final project for ME333 in 2009. User-specified images (and even moving images) were displayed by rotating a column of LEDs at speeds faster than 300rpm. Each individual LED was modeled as a row of pixels. Conversely, the rotational position of the panel of LEDs represented the pixel columns of the display; the time interval and rotational speed determined the width of the pixel columns.&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
* Gregory McGlynn (Computer Science, Class of 2011) [left]&lt;br /&gt;
* Kwang Xiong Sim (Mechanical Engineering, Class of 2010) [center]&lt;br /&gt;
* Alexander Park (Material Science and Engineering, Class of 2009) [right]&lt;br /&gt;
&lt;br /&gt;
=== Theory of Persistence of Vision ===&lt;br /&gt;
Although arguably much more complex, human vision functions in a manner similar to modern motion pictures; our eyes retain images for a fraction of a second, not unlike a frame in a movie. This is called persistence of vision (POV). When images change fast enough, what we see is a subtle blend of what we see now and a fraction of a second ago.&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
[[image:POVschematic|thumb|right|250px|Schematic of POV Display]]&lt;br /&gt;
In order to avoid the complication of wiring a spinning object, all of the major components of the POV display were placed on a platform mounted on the output shaft of a [[Actuators Available in the Mechatronics Lab#6W Maxon motor with 6:1 gearhead and 100 line encoder|6W Maxon motor]]. The components of this rotating platform include a [[PIC Microcontroller]], a panel of 14 bright white LEDs, a [[Hall Effect Sensor|Hall switch]], an [[XBee radio communication between PICs|XBee radio]], and a battery pack to power the assembly. The strip of LEDs was mounted vertically (or parallel to the axis of rotation) at one end of the platform. To minimize wobbling of the assembly while spinning, the components were positioned such that the center of gravity of the panel passed through the axis of rotation.&lt;br /&gt;
&lt;br /&gt;
Wireless communication between two PICs via [[XBee radio communication between PICs|XBees]] was used to enable live updating of the display based on user input: one PIC (the &amp;quot;display&amp;quot; PIC) was used to control the POV display and receive wireless information from a second PIC. This second &amp;quot;controller&amp;quot; PIC was used to receive user input and transmit it to the display PIC.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Modes of Operation ===&lt;br /&gt;
The POV display has two modes of operation, corresponding to two different input methods. &lt;br /&gt;
&lt;br /&gt;
In the first mode of operation, the controller PIC transmits previously stored data to the PIC on the rotor panel. By varying the resistance of a [[Potentiometers|potentiometer]] on the control panel, the user can choose between eleven &amp;quot;canned&amp;quot; messages.&lt;br /&gt;
&lt;br /&gt;
In the second mode of operation, the controller PIC is connected to a computer via [[PIC RS232#FTDIChip TTL-232R USB to RS232 Cable|USB]]. Using a Java program written by Gregory McGlynn, the user can draw pictures or type letters in real time on the computer screen and on the POV display. &lt;br /&gt;
&lt;br /&gt;
=== Position Sensing ===&lt;br /&gt;
To allow for accurate portrayal of the desired image, a [[Hall Effect Sensor|Hall switch]] was utilized to implement position sensing. The Hall switch was mounted near the end of the rotor display platform and a magnet was attached on the top of the base box. The magnet was positioned directly under the path of the hall sensor such that each rotation of the platform triggered an electrical pulse. The display PIC was programmed to reset the image cycle each time a pulse was sensed from the Hall sensor. This allowed reproduction of a stationary image.&lt;br /&gt;
&lt;br /&gt;
Using this implementation of the Hall switch, the display POV was programmed to calculate the rotational velocity of the POV after each rotation by timing the interval between pulses from the Hall switch. This allows for correction of pixel column spacing, such that the column width is consistent even at different speeds. As such, the display may function properly without any information from the motor about its speed.&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Mechanical Design ==&lt;br /&gt;
=== Base ===&lt;br /&gt;
[[image:POV_CADdrawing|right|thumb|250px|CAD representation of POV Display]]&lt;br /&gt;
The base box was fabricated using black expanded PVC. There are three rectangular faces (the back, top, and bottom), two trapezoidal sides and a door that is hinged at the base such that it opens outwards. The control panel was mounted on the inner face of the door.&lt;br /&gt;
&lt;br /&gt;
A wooden base was mounted to the bottom of this PVC box both to increase the box&amp;#039;s integrity and to add to stability of the system with additional mass. A slot was cut near the back of the wooden panel to hold motor in place. &lt;br /&gt;
&lt;br /&gt;
The motor output shaft was connected to the POV display platform through an aluminum coupler. This coupler extended out the top of the box through a [[Bearings|radial ball bearing]], which served to reduce lateral motion of the display platform and to support some of the weight of the platform. The end of the coupler was machined to fit snugly  in to a slot-shaped hole in the display platform. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;Br&amp;gt;&amp;lt;Br&amp;gt;&lt;br /&gt;
=== Control Panel ===&lt;br /&gt;
[[image:Picture of Control Panel|right|thumb|250px|Picture of Control Panel]]&lt;br /&gt;
Several knobs, buttons, and switches were placed on a control panel to allow for user input: 1) Motor power switch, 2) Motor speed knob, 3) Selection knob for stored responses, 4) Selection button for stored response, 5) Message position knob, and 6) Scroll speed knob. These components were mounted on a piece of expanded PVC through appropriately sized holes. Specifics on the implementation of these components are described below in the Electronic Design section.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;Br&amp;gt;&amp;lt;Br&amp;gt;&amp;lt;Br&amp;gt;&amp;lt;Br&amp;gt;&amp;lt;Br&amp;gt;&amp;lt;Br&amp;gt;&lt;br /&gt;
=== Rotating Display Platform ===&lt;br /&gt;
[[image:Picture of Display Platform|right|thumb|250px|Picture of Display Platform]]&lt;br /&gt;
Because the display platform rotates rapidly during operation, all of the components were mounted rigidly onto two sheets of expanded PVC. These two sheets were screwed together at the center of the platform, such that a double layer of material was created at the slot for the motor coupler. At one end of the platform, the panel of 14 vertically mounted LEDs was mounted. The electronics of the platform (consisting of a solder board and a PIC board separated by standoffs) were mounted behind the LED panel. A 6V battery pack (4AA&amp;#039;s) was mounted at the opposite end of the platform with Velcro. This non-permanent positioning of the battery pack was chosen so that the batteries could be easily replaced and such that the batteries could act as an adjustable counterbalance for the entire platform.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;Br&amp;gt;&amp;lt;Br&amp;gt;&lt;br /&gt;
=== Parts List ===&lt;br /&gt;
* (1) [[Actuators Available in the Mechatronics Lab#6W Maxon motor with 6:1 gearhead and 100 line encoder|6W Maxon Motor]]&lt;br /&gt;
* (1) Toggle Switch&lt;br /&gt;
* (1) 25Ohm Potentiometer&lt;br /&gt;
* (1) Radial ball bearing&lt;br /&gt;
* Expanded PVC sheet&lt;br /&gt;
* Wood (approx. 6&amp;quot; x 5&amp;quot; x 0.5&amp;quot;)&lt;br /&gt;
* Sheet metal screws&lt;br /&gt;
* Various nuts and bolts&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Electrical Design ==&lt;br /&gt;
=== Display PIC Electronics ===&lt;br /&gt;
[[Image:POVschematicsmall.jpg|thumb|right|Rotating display circuit (click for high-resolution version)]]&lt;br /&gt;
The rotating display platform has 14 LEDs which were controlled through Ports C and D of a PIC. Because bright LEDs were used, the amount of current need could not be supplied directly from the output ports of the PIC. As such, the LEDs were wired through two Darlington arrays (DS2003). These ICs consist of 7 [[Diodes and Transistors#Darlington Pair|Darlington pairs]] with a common emitter. The outputs of the PIC were connected to the bases of the transistors; when the PIC drives one of the bases high, current can flow through the transistor and the corresponding LED lights up. We did not find it necessary to use any resistors in this design.&lt;br /&gt;
&lt;br /&gt;
The display uses a [[Hall Effect Sensor|Hall switch]] to synchronize its display with its rotation, as described above. The implemented circuit, as shown schematically at the right, causes pin B0 of the PIC to go low whenever the hall switch is near the magnet mounted on the base box; when the PIC detects this falling edge on pin B0 it knows its relative position. By timing the interval between two of these events the PIC calculates how fast the display is rotating and adjusts its timing accordingly.&lt;br /&gt;
&lt;br /&gt;
The display receives commands from the controller PIC via an [[XBee radio communication between PICs|XBee]] radio module.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Controller PIC Electronics  ===&lt;br /&gt;
[[Image:AP_KS_GM=Control_panel_schematic.jpg|thumb|right|Control panel circuit (click for high-resolution version)]]&lt;br /&gt;
When using the first [[Persistence-of-Vision Display#Modes of Operation|mode of operation]], the control panel receives user input through three 1000-Ohm potentiometers and a push button. The states of these controls are read by the PIC which uses its XBee radio module to send appropriate commands to the display.&lt;br /&gt;
&lt;br /&gt;
If the USB cable is plugged in, the second mode of operation takes effect and the controller PIC is also responsible for accepting commands from the PC and relaying them to the display PIC through the XBee.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;Br&amp;gt;&amp;lt;Br&amp;gt;&amp;lt;Br&amp;gt;&amp;lt;Br&amp;gt;&amp;lt;Br&amp;gt;&amp;lt;Br&amp;gt;&amp;lt;Br&amp;gt;&lt;br /&gt;
=== Motor Control Electronics ===&lt;br /&gt;
The motor and its electronics were wired separately from the rest of the electronics. A toggle switch was wired in series with a variable resistor (a 25-Ohm potentiometer) between the motor and a 24V power supply. This allowed for the toggle switch to be used as a simple on/off power switch, and the potentiometer to be used to tune the voltage across the motor, effectively varying its speed.&lt;br /&gt;
&lt;br /&gt;
=== Parts list ===&lt;br /&gt;
* (2) PIC18F4520 microcontrollers&lt;br /&gt;
* (1) XBee Radio pair and their [[XBee Interface Board|interface boards]]&lt;br /&gt;
* (2) Darlington Pair Arrays (DS2003)&lt;br /&gt;
* (1) Hall switch&lt;br /&gt;
* (14) Bright white LEDs&lt;br /&gt;
* (3) 1000-Ohm potentiometers&lt;br /&gt;
* (1) Push-button&lt;br /&gt;
* (1) [[Actuators Available in the Mechatronics Lab#6W Maxon motor with 6:1 gearhead and 100 line encoder|6W Maxon Motor]]&lt;br /&gt;
* (1) Toggle Switch&lt;br /&gt;
* (1) 25-Ohm Potentiometer&lt;br /&gt;
* Solder Board&lt;br /&gt;
* Stranded wire&lt;br /&gt;
* 10-wire stranded ribbon cable.&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Code ==&lt;br /&gt;
&lt;br /&gt;
[[AP_KS_GM-control_panel_code.c|Code for the control panel PIC]]&lt;br /&gt;
&lt;br /&gt;
[[AP_KS_GM-pov_code.c|Code for the display PIC]]&lt;br /&gt;
&lt;br /&gt;
[[AP_KS_GM-POVInput.java|Code for the PC applet]]&lt;br /&gt;
&lt;br /&gt;
== Results ==&lt;br /&gt;
=== Mode 1: Canned Response ===&lt;br /&gt;
In the first mode of operation, the user can just plug in the POV display into a wall socket, turn on the display PIC&amp;#039;s power, and turn on the motor to display an image. This allows for a quick and easy demonstration without a computer. We have stored eleven different responses on the display PIC&amp;#039;s ROM. Using a knob and a button on the control panel, the user can set which canned response is displayed.&lt;br /&gt;
&lt;br /&gt;
http://www.youtube.com/watch?v=zx5eXrf9oQI[http://www.youtube.com/watch?v=zx5eXrf9oQI]&lt;br /&gt;
&lt;br /&gt;
=== Mode 2: Real time image input ===&lt;br /&gt;
In the second mode of operation, a user can interact more closely with the POV display. In this mode, the POV  display is connected via a USB port to a computer which needs to have Java installed. The Java program with the code listed above allows users to draw pictures or type letters which will be transmitted in real time from the controller PIC to the display PIC through the wireless XBee chips.&lt;br /&gt;
&lt;br /&gt;
In both modes of operation, we have set up knobs that will allow a user to scroll a message manually or set the scroll speed of an image. &lt;br /&gt;
&lt;br /&gt;
http://www.youtube.com/watch?v=urz729AbkG4[http://www.youtube.com/watch?v=urz729AbkG4]&lt;br /&gt;
&lt;br /&gt;
== Additional Notes ==&lt;br /&gt;
=== How to use the POV Display (a small user&amp;#039;s manual) ===&lt;br /&gt;
In its most basic mode of operation, the display is simple to use: &lt;br /&gt;
*Plug the power cord into the wall.&lt;br /&gt;
*Turn the battery pack on the rotating display on.&lt;br /&gt;
*Unfold the control panel, and flip the power switch. &lt;br /&gt;
The display should spin up and the text &amp;quot;ME333 - Mechatronics&amp;quot; should be displayed. Try out the control panel knobs!&lt;br /&gt;
&lt;br /&gt;
It&amp;#039;s also possible to draw your own images for the display in real time using the PC software. Note that this program will on run on &amp;#039;&amp;#039;&amp;#039;Windows&amp;#039;&amp;#039;&amp;#039; machines. Here&amp;#039;s how to install the program:&lt;br /&gt;
*Download [[POV-PC.zip]] and save it in its own directory somewhere on your computer.&lt;br /&gt;
*Unzip POV-PC.zip with WinZip or some other unzipping tool.&lt;br /&gt;
*This will extract 3 files. The important one is POVController.exe. Running this will start the control program.&lt;br /&gt;
You can run POVController.exe by navigating to the folder it&amp;#039;s in with Windows Explorer and double-clicking on the icon. If you want you can create a shortcut to POVController.exe and drag it onto the desktop for easy access.&lt;br /&gt;
&lt;br /&gt;
Before you run the program you&amp;#039;ll need to plug the USB cable into the computer. This creates a serial port on the computer which the program uses to talk to the POV. Serial ports are named things like &amp;quot;COM5&amp;quot; or &amp;quot;COM7&amp;quot;. You need to find out the number of the com port. One way to to this is with the device manager. Open up the device manager and look under &amp;quot;Ports (COM &amp;amp; LPT)&amp;quot;. You should see something like &amp;quot;USB Serial Port (COM5)&amp;quot;, probably with a different number than 5. Remember the number; the program will prompt you for it when it starts up.&lt;br /&gt;
&lt;br /&gt;
So start up POVController.exe and give it the COM port number (i.e. if your USB cable is port COM5 just enter &amp;quot;5&amp;quot; when prompted). The graphical interface will appear. You can draw on the grid with your mouse and your image will appear on the display. You&amp;#039;ll probably want to clear the display first. You can also type text. If your drawing doesn&amp;#039;t show up you can try hitting the refresh button. Don&amp;#039;t press the refresh button a bunch of times; refreshing takes a few seconds and if you click it say five times it will try to refresh five times and won&amp;#039;t respond for fifteen seconds or so.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Troubleshooting&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;I don&amp;#039;t see any lights!&amp;#039;&amp;#039;&amp;#039; - Did you turn on the battery pack on the display? &lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;When I type none of my letters appear in the interface!&amp;#039;&amp;#039;&amp;#039; - Try pressing backspace a bunch of times.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;None of the controls work!&amp;#039;&amp;#039;&amp;#039; - Try turning off the motor, letting the display spin down, and then pushing the reset buttons on both PICs. Sometimes the communication between the two PICs gets misaligned and the PICs have to be reset.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Possible Future Improvements/Enhancements ===&lt;br /&gt;
We have thought about using RGB LEDS to give the display panel more colorful. Also, we can use different sensors to make the display more interactive. For example putting on distance sensors on the display so that the panel color scheme changes when you wave a hand in front of it.&lt;/div&gt;</summary>
		<author><name>Kwang Sim</name></author>
	</entry>
	<entry>
		<id>https://hades.mech.northwestern.edu//index.php?title=Persistence-of-Vision_Display&amp;diff=12486</id>
		<title>Persistence-of-Vision Display</title>
		<link rel="alternate" type="text/html" href="https://hades.mech.northwestern.edu//index.php?title=Persistence-of-Vision_Display&amp;diff=12486"/>
		<updated>2009-03-20T01:39:56Z</updated>

		<summary type="html">&lt;p&gt;Kwang Sim: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Overview ==&lt;br /&gt;
[[image:POV|right]]&lt;br /&gt;
A fully customizable display using the concept of Persistence of Vision was created as a final project for ME333 in 2009. User-specified images (and even moving images) were displayed by rotating a column of LEDs at speeds faster than 300rpm. Each individual LED was modeled as a row of pixels. Conversely, the rotational position of the panel of LEDs represented the pixel columns of the display; the time interval and rotational speed determined the width of the pixel columns.&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
* Gregory McGlynn (Computer Science, Class of 2011) [left]&lt;br /&gt;
* Kwang Xiong Sim (Mechanical Engineering, Class of 2010) [center]&lt;br /&gt;
* Alexander Park (Material Science and Engineering, Class of 2009) [right]&lt;br /&gt;
&lt;br /&gt;
=== Theory of Persistence of Vision ===&lt;br /&gt;
Although arguably much more complex, human vision functions in a manner similar to modern motion pictures; our eyes retain images for a fraction of a second, not unlike a frame in a movie. This is called persistence of vision (POV). When images change fast enough, what we see is a subtle blend of what we see now and a fraction of a second ago.&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
[[image:POVschematic|thumb|right|250px|Schematic of POV Display]]&lt;br /&gt;
In order to avoid the complication of wiring a spinning object, all of the major components of the POV display were placed on a platform mounted on the output shaft of a [[Actuators Available in the Mechatronics Lab#6W Maxon motor with 6:1 gearhead and 100 line encoder|6W Maxon motor]]. The components of this rotating platform include a [[PIC Microcontroller]], a panel of 14 bright white LEDs, a [[Hall Effect Sensor|Hall switch]], an [[XBee radio communication between PICs|XBee radio]], and a battery pack to power the assembly. The strip of LEDs was mounted vertically (or parallel to the axis of rotation) at one end of the platform. To minimize wobbling of the assembly while spinning, the components were positioned such that the center of gravity of the panel passed through the axis of rotation.&lt;br /&gt;
&lt;br /&gt;
Wireless communication between two PICs via [[XBee radio communication between PICs|XBees]] was used to enable live updating of the display based on user input: one PIC (the &amp;quot;display&amp;quot; PIC) was used to control the POV display and receive wireless information from a second PIC. This second &amp;quot;controller&amp;quot; PIC was used to receive user input and transmit it to the display PIC.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Modes of Operation ===&lt;br /&gt;
The POV display has two modes of operation, corresponding to two different input methods. &lt;br /&gt;
&lt;br /&gt;
In the first mode of operation, the controller PIC transmits previously stored data to the PIC on the rotor panel. By varying the resistance of a [[Potentiometers|potentiometer]] on the control panel, the user can choose between eleven &amp;quot;canned&amp;quot; messages.&lt;br /&gt;
&lt;br /&gt;
In the second mode of operation, the controller PIC is connected to a computer via [[PIC RS232#FTDIChip TTL-232R USB to RS232 Cable|USB]]. Using a Java program written by Gregory McGlynn, the user can draw pictures or type letters in real time on the computer screen and on the POV display. &lt;br /&gt;
&lt;br /&gt;
=== Position Sensing ===&lt;br /&gt;
To allow for accurate portrayal of the desired image, a [[Hall Effect Sensor|Hall switch]] was utilized to implement position sensing. The Hall switch was mounted near the end of the rotor display platform and a magnet was attached on the top of the base box. The magnet was positioned directly under the path of the hall sensor such that each rotation of the platform triggered an electrical pulse. The display PIC was programmed to reset the image cycle each time a pulse was sensed from the Hall sensor. This allowed reproduction of a stationary image.&lt;br /&gt;
&lt;br /&gt;
Using this implementation of the Hall switch, the display POV was programmed to calculate the rotational velocity of the POV after each rotation by timing the interval between pulses from the Hall switch. This allows for correction of pixel column spacing, such that the column width is consistent even at different speeds. As such, the display may function properly without any information from the motor about its speed.&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Mechanical Design ==&lt;br /&gt;
=== Base ===&lt;br /&gt;
[[image:POV_CADdrawing|right|thumb|250px|CAD representation of POV Display]]&lt;br /&gt;
The base box was fabricated using black expanded PVC. There are three rectangular faces (the back, top, and bottom), two trapezoidal sides and a door that is hinged at the base such that it opens outwards. The control panel was mounted on the inner face of the door.&lt;br /&gt;
&lt;br /&gt;
A wooden base was mounted to the bottom of this PVC box both to increase the box&amp;#039;s integrity and to add to stability of the system with additional mass. A slot was cut near the back of the wooden panel to hold motor in place. &lt;br /&gt;
&lt;br /&gt;
The motor output shaft was connected to the POV display platform through an aluminum coupler. This coupler extended out the top of the box through a [[Bearings|radial ball bearing]], which served to reduce lateral motion of the display platform and to support some of the weight of the platform. The end of the coupler was machined to fit snugly  in to a slot-shaped hole in the display platform. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;Br&amp;gt;&amp;lt;Br&amp;gt;&lt;br /&gt;
=== Control Panel ===&lt;br /&gt;
[[image:Picture of Control Panel|right|thumb|250px|Picture of Control Panel]]&lt;br /&gt;
Several knobs, buttons, and switches were placed on a control panel to allow for user input: 1) Motor power switch, 2) Motor speed knob, 3) Selection knob for stored responses, 4) Selection button for stored response, 5) Message position knob, and 6) Scroll speed knob. These components were mounted on a piece of expanded PVC through appropriately sized holes. Specifics on the implementation of these components are described below in the Electronic Design section.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;Br&amp;gt;&amp;lt;Br&amp;gt;&amp;lt;Br&amp;gt;&amp;lt;Br&amp;gt;&amp;lt;Br&amp;gt;&amp;lt;Br&amp;gt;&lt;br /&gt;
=== Rotating Display Platform ===&lt;br /&gt;
[[image:Picture of Display Platform|right|thumb|250px|Picture of Display Platform]]&lt;br /&gt;
Because the display platform rotates rapidly during operation, all of the components were mounted rigidly onto two sheets of expanded PVC. These two sheets were screwed together at the center of the platform, such that a double layer of material was created at the slot for the motor coupler. At one end of the platform, the panel of 14 vertically mounted LEDs was mounted. The electronics of the platform (consisting of a solder board and a PIC board separated by standoffs) were mounted behind the LED panel. A 6V battery pack (4AA&amp;#039;s) was mounted at the opposite end of the platform with Velcro. This non-permanent positioning of the battery pack was chosen so that the batteries could be easily replaced and such that the batteries could act as an adjustable counterbalance for the entire platform.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;Br&amp;gt;&amp;lt;Br&amp;gt;&lt;br /&gt;
=== Parts List ===&lt;br /&gt;
* (1) [[Actuators Available in the Mechatronics Lab#6W Maxon motor with 6:1 gearhead and 100 line encoder|6W Maxon Motor]]&lt;br /&gt;
* (1) Toggle Switch&lt;br /&gt;
* (1) 25Ohm Potentiometer&lt;br /&gt;
* (1) Radial ball bearing&lt;br /&gt;
* Expanded PVC sheet&lt;br /&gt;
* Wood (approx. 6&amp;quot; x 5&amp;quot; x 0.5&amp;quot;)&lt;br /&gt;
* Sheet metal screws&lt;br /&gt;
* Various nuts and bolts&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Electrical Design ==&lt;br /&gt;
=== Display PIC Electronics ===&lt;br /&gt;
[[Image:POVschematicsmall.jpg|thumb|right|Rotating display circuit (click for high-resolution version)]]&lt;br /&gt;
The rotating display platform has 14 LEDs which were controlled through Ports C and D of a PIC. Because bright LEDs were used, the amount of current need could not be supplied directly from the output ports of the PIC. As such, the LEDs were wired through two Darlington arrays (DS2003). These ICs consist of 7 [[Diodes and Transistors#Darlington Pair|Darlington pairs]] with a common emitter. The outputs of the PIC were connected to the bases of the transistors; when the PIC drives one of the bases high, current can flow through the transistor and the corresponding LED lights up. We did not find it necessary to use any resistors in this design.&lt;br /&gt;
&lt;br /&gt;
The display uses a [[Hall Effect Sensor|Hall switch]] to synchronize its display with its rotation, as described above. The implemented circuit, as shown schematically at the right, causes pin B0 of the PIC to go low whenever the hall switch is near the magnet mounted on the base box; when the PIC detects this falling edge on pin B0 it knows its relative position. By timing the interval between two of these events the PIC calculates how fast the display is rotating and adjusts its timing accordingly.&lt;br /&gt;
&lt;br /&gt;
The display receives commands from the controller PIC via an [[XBee radio communication between PICs|XBee]] radio module.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Controller PIC Electronics  ===&lt;br /&gt;
[[Image:AP_KS_GM=Control_panel_schematic.jpg|thumb|right|Control panel circuit (click for high-resolution version)]]&lt;br /&gt;
When using the first [[Persistence-of-Vision Display#Modes of Operation|mode of operation]], the control panel receives user input through three 1000-Ohm potentiometers and a push button. The states of these controls are read by the PIC which uses its XBee radio module to send appropriate commands to the display.&lt;br /&gt;
&lt;br /&gt;
If the USB cable is plugged in, the second mode of operation takes effect and the controller PIC is also responsible for accepting commands from the PC and relaying them to the display PIC through the XBee.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;Br&amp;gt;&amp;lt;Br&amp;gt;&amp;lt;Br&amp;gt;&amp;lt;Br&amp;gt;&amp;lt;Br&amp;gt;&amp;lt;Br&amp;gt;&amp;lt;Br&amp;gt;&lt;br /&gt;
=== Motor Control Electronics ===&lt;br /&gt;
The motor and its electronics were wired separately from the rest of the electronics. A toggle switch was wired in series with a variable resistor (a 25-Ohm potentiometer) between the motor and a 24V power supply. This allowed for the toggle switch to be used as a simple on/off power switch, and the potentiometer to be used to tune the voltage across the motor, effectively varying its speed.&lt;br /&gt;
&lt;br /&gt;
=== Parts list ===&lt;br /&gt;
* (2) PIC18F4520 microcontrollers&lt;br /&gt;
* (1) XBee Radio pair and their [[XBee Interface Board|interface boards]]&lt;br /&gt;
* (2) Darlington Pair Arrays (DS2003)&lt;br /&gt;
* (1) Hall switch&lt;br /&gt;
* (14) Bright white LEDs&lt;br /&gt;
* (3) 1000-Ohm potentiometers&lt;br /&gt;
* (1) Push-button&lt;br /&gt;
* (1) [[Actuators Available in the Mechatronics Lab#6W Maxon motor with 6:1 gearhead and 100 line encoder|6W Maxon Motor]]&lt;br /&gt;
* (1) Toggle Switch&lt;br /&gt;
* (1) 25-Ohm Potentiometer&lt;br /&gt;
* Solder Board&lt;br /&gt;
* Stranded wire&lt;br /&gt;
* 10-wire stranded ribbon cable.&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Code ==&lt;br /&gt;
&lt;br /&gt;
[[AP_KS_GM-control_panel_code.c|Code for the control panel PIC]]&lt;br /&gt;
&lt;br /&gt;
[[AP_KS_GM-pov_code.c|Code for the display PIC]]&lt;br /&gt;
&lt;br /&gt;
[[AP_KS_GM-POVInput.java|Code for the PC applet]]&lt;br /&gt;
&lt;br /&gt;
== Results ==&lt;br /&gt;
=== Mode 1: Canned Response ===&lt;br /&gt;
In the first mode of operation, the user can just plug in the POV display into a wall socket, turn on the display PIC&amp;#039;s power, and turn on the motor to display an image. This allows for a quick and easy demonstration without a computer. We have stored eleven different responses on the display PIC&amp;#039;s ROM. Using a knob and a button on the control panel, the user can set which canned response is displayed.&lt;br /&gt;
&lt;br /&gt;
http://www.youtube.com/watch?v=zx5eXrf9oQI[http://www.youtube.com/watch?v=zx5eXrf9oQI]&lt;br /&gt;
&lt;br /&gt;
=== Mode 2: Real time image input ===&lt;br /&gt;
In the second mode of operation, a user can interact more closely with the POV display. In this mode, the POV  display is connected via a USB port to a computer which needs to have Java installed. The Java program with the code listed above allows users to draw pictures or type letters which will be transmitted in real time from the controller PIC to the display PIC through the wireless XBee chips.&lt;br /&gt;
&lt;br /&gt;
In both modes of operation, we have set up knobs that will allow a user to scroll a message manually or set the scroll speed of an image. &lt;br /&gt;
&lt;br /&gt;
http://www.youtube.com/watch?v=urz729AbkG4[http://www.youtube.com/watch?v=urz729AbkG4]&lt;br /&gt;
&lt;br /&gt;
== Additional Notes ==&lt;br /&gt;
=== Possible Future Improvements/Enhancements ===&lt;br /&gt;
We have thought about using RGB LEDS to give the display panel more colorful. Also, we can use different sensors to make the display more interactive. For example putting on distance sensors on the display so that the panel color scheme changes when you wave a hand in front of it.&lt;/div&gt;</summary>
		<author><name>Kwang Sim</name></author>
	</entry>
	<entry>
		<id>https://hades.mech.northwestern.edu//index.php?title=Persistence-of-Vision_Display&amp;diff=12197</id>
		<title>Persistence-of-Vision Display</title>
		<link rel="alternate" type="text/html" href="https://hades.mech.northwestern.edu//index.php?title=Persistence-of-Vision_Display&amp;diff=12197"/>
		<updated>2009-03-19T22:55:05Z</updated>

		<summary type="html">&lt;p&gt;Kwang Sim: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Overview ==&lt;br /&gt;
[[image:POV|right]]&lt;br /&gt;
A fully customizable display using the concept of Persistence of Vision was created as a final project for ME333 in 2009. User-specified images (and even moving images) were displayed by rotating a column of LEDs at speeds faster than 300rpm. Each individual LED was modeled as a row of pixels. Conversely, the rotational position of the panel of LEDs represented the pixel columns of the display; the time interval and rotational speed determined the width of the pixel columns.&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
* Gregory McGlynn (Computer Science, Class of 2011) [left]&lt;br /&gt;
* Kwang Xiong Sim (Mechanical Engineering, Class of 2010) [center]&lt;br /&gt;
* Alexander Park (Material Science and Engineering, Class of 2009) [right]&lt;br /&gt;
&lt;br /&gt;
=== Theory of Persistence of Vision ===&lt;br /&gt;
Although arguably much more complex, human vision functions in a manner similar to modern motion pictures; our eyes retain images for a fraction of a second, not unlike a frame in a movie. This is called persistence of vision (POV). When images change fast enough, what we see is a subtle blend of what we see now and a fraction of a second ago.&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
[[image:POVschematic|thumb|right|250px|Schematic of POV Display]]&lt;br /&gt;
In order to avoid the complication of wiring a spinning object, all of the major components of the POV display were placed on a platform mounted on the output shaft of a [[Actuators Available in the Mechatronics Lab#6W Maxon motor with 6:1 gearhead and 100 line encoder|6W Maxon motor]]. The components of this rotating platform include a [[PIC Microcontroller]], a panel of 14 bright white LEDs, a [[Hall Effect Sensor|Hall switch]], an [[XBee radio communication between PICs|XBee radio]], and a battery pack to power the assembly. The strip of LEDs was mounted vertically (or parallel to the axis of rotation) at one end of the platform. To minimize wobbling of the assembly while spinning, the components were positioned such that the center of gravity of the panel passed through the axis of rotation.&lt;br /&gt;
&lt;br /&gt;
Wireless communication between two PICs via [[XBee radio communication between PICs|XBees]] was used to enable live updating of the display based on user input: one PIC (the &amp;quot;display&amp;quot; PIC) was used to control the POV display and receive wireless information from a second PIC. This second &amp;quot;controller&amp;quot; PIC was used to receive user input and transmit it to the display PIC.&lt;br /&gt;
&lt;br /&gt;
=== Modes of Operation ===&lt;br /&gt;
The POV display has two modes of operation, corresponding to two different input methods. &lt;br /&gt;
&lt;br /&gt;
In the first mode of operation, the controller PIC transmits previously stored data to the PIC on the rotor panel. By varying the resistance of a [[Potentiometers|potentiometer]] on the control panel, the user can choose between eleven &amp;quot;canned&amp;quot; messages.&lt;br /&gt;
&lt;br /&gt;
In the second mode of operation, the controller PIC is connected to a computer via [[PIC RS232#FTDIChip TTL-232R USB to RS232 Cable|USB]]. Using a Java program written by Gregory McGlynn, the user can draw pictures or type letters in real time on the computer screen and on the POV display. &lt;br /&gt;
&lt;br /&gt;
=== Position Sensing ===&lt;br /&gt;
To allow for accurate portrayal of the desired image, a [[Hall Effect Sensor|Hall switch]] was utilized to implement position sensing. The Hall switch was mounted near the end of the rotor display platform and a magnet was attached on the top of the base box. The magnet was positioned directly under the path of the hall sensor such that each rotation of the platform triggered an electrical pulse. The display PIC was programmed to reset the image cycle each time a pulse was sensed from the Hall sensor. This allowed reproduction of a stationary image.&lt;br /&gt;
&lt;br /&gt;
Using this implementation of the Hall switch, the display POV was programmed to calculate the rotational velocity of the POV after each rotation by timing the interval between pulses from the Hall switch. This allows for correction of pixel column spacing, such that the column width is consistent even at different speeds. As such, the display may function properly without any information from the motor about its speed.&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Mechanical Design ==&lt;br /&gt;
[[image:POV_CADdrawing|right|thumb|250px|CAD representation of POV Display]]&lt;br /&gt;
=== Base ===&lt;br /&gt;
The base box was fabricated using black expanded PVC. There are three rectangular faces (the back, top, and bottom), two trapezoidal sides and a door that is hinged at the base such that it opens outwards. The control panel was mounted on the inner face of the door.&lt;br /&gt;
&lt;br /&gt;
A wooden base was mounted to the bottom of this PVC box both to increase the box&amp;#039;s integrity and to add to stability of the system with additional mass. A slot was cut near the back of the wooden panel to hold motor in place. &lt;br /&gt;
&lt;br /&gt;
The motor output shaft was connected to the POV display platform through an aluminum coupler. This coupler extended out the top of the box through a [[Bearings|radial ball bearing]], which served to reduce lateral motion of the display platform and to support some of the weight of the platform. The end of the coupler was machined to fit snugly  in to a slot-shaped hole in the display platform. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;Br&amp;gt;.&amp;lt;Br&amp;gt;.&amp;lt;Br&amp;gt;.&lt;br /&gt;
=== Control Panel ===&lt;br /&gt;
[[image:Picture of Control Panel|right|thumb|250px|Picture of Control Panel]]&lt;br /&gt;
Several knobs, buttons, and switches were placed on a control panel to allow for user input: 1) Motor power switch, 2) Motor speed knob, 3) Selection knob for stored responses, 4) Selection button for stored response, 5) Message position knob, and 6) Scroll speed knob. These components were mounted on a piece of expanded PVC through appropriately sized holes. Specifics on the implementation of these components are described below in the Electronic Design section.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;Br&amp;gt;.&amp;lt;Br&amp;gt;.&amp;lt;Br&amp;gt;.&amp;lt;Br&amp;gt;.&amp;lt;Br&amp;gt;.&amp;lt;Br&amp;gt;.&lt;br /&gt;
=== Rotating Display Platform ===&lt;br /&gt;
[[image:Picture of Display Platform|right|thumb|250px|Picture of Display Platform]]&lt;br /&gt;
Because the display platform rotates rapidly during operation, all of the components were mounted rigidly onto two sheets of expanded PVC. These two sheets were screwed together at the center of the platform, such that a double layer of material was created at the slot for the motor coupler. At one end of the platform, the panel of 14 vertically mounted LEDs was mounted. The electronics of the platform (consisting of a solder board and a PIC board separated by standoffs) were mounted behind the LED panel. A 6V battery pack (4AA&amp;#039;s) was mounted at the opposite end of the platform with Velcro. This non-permanent positioning of the battery pack was chosen so that the batteries could be easily replaced and such that the batteries could act as an adjustable counterbalance for the entire platform.&lt;br /&gt;
&lt;br /&gt;
=== Parts List ===&lt;br /&gt;
* (1) [[Actuators Available in the Mechatronics Lab#6W Maxon motor with 6:1 gearhead and 100 line encoder|6W Maxon Motor]]&lt;br /&gt;
* (1) Toggle Switch&lt;br /&gt;
* (1) 25Ohm Potentiometer&lt;br /&gt;
* (1) Radial ball bearing&lt;br /&gt;
* Expanded PVC sheet&lt;br /&gt;
* Wood (approx. 6&amp;quot; x 5&amp;quot; x 0.5&amp;quot;)&lt;br /&gt;
* Sheet metal screws&lt;br /&gt;
* Various nuts and bolts&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Electrical Design ==&lt;br /&gt;
=== Display PIC Electronics ===&lt;br /&gt;
[[Image:POVschematicsmall.jpg|400px|right|Display circuit]]&lt;br /&gt;
The rotating display platform has 14 LEDs which were controlled through Ports C and D of a PIC. Because bright LEDs were used, the amount of current need could not be supplied directly from the output ports of the PIC. As such, the LEDs were wired through two Darlington arrays (DS2003). These ICs consist of 7 [[Diodes and Transistors#Darlington Pair|Darlington pairs]] with a common emitter. The outputs of the PIC were connected to the bases of the transistors; when the PIC drives one of the bases high, current can flow through the transistor and the corresponding LED lights up. We did not find it necessary to use any resistors in this design.&lt;br /&gt;
&lt;br /&gt;
The display uses a [[Hall Effect Sensor|Hall switch]] to synchronize its display with its rotation, as described above. The implemented circuit, as shown schematically at the right, causes pin B0 of the PIC to go low whenever the hall switch is near the magnet mounted on the base box; when the PIC detects this falling edge on pin B0 it knows its relative position. By timing the interval between two of these events the PIC calculates how fast the display is rotating and adjusts its timing accordingly.&lt;br /&gt;
&lt;br /&gt;
The display receives commands from the controller PIC via an [[XBee radio communication between PICs|XBee]] radio module.&lt;br /&gt;
&lt;br /&gt;
=== Controller PIC Electronics  ===&lt;br /&gt;
[[Image:AP_KS_GM=Control_panel_schematic.jpg|400px|right|Control panel circuit]]&lt;br /&gt;
When using the first mode of operation, the control panel receives user input through three potentiometers and a push button. The states of these controls are read by the PIC which uses its XBee radio module to send appropriate commands to the display.&lt;br /&gt;
&lt;br /&gt;
If the USB cable is plugged in, the control panel is also responsible for accepting commands from the PC and relaying these commands to the POV through the XBee.&lt;br /&gt;
&lt;br /&gt;
=== Parts list ===&lt;br /&gt;
* (2) PIC18F4520 microcontrollers&lt;br /&gt;
* (1) XBee Radio pair and their [[XBee Interface Board|interface boards]]&lt;br /&gt;
* (2) Darlington Pair Arrays (DS2003)&lt;br /&gt;
* (1) Hall switch&lt;br /&gt;
* (14) Bright white LEDs&lt;br /&gt;
* (3) 1000-Ohm potentiometers&lt;br /&gt;
* Push-button&lt;br /&gt;
* Solder Board&lt;br /&gt;
* Stranded wire&lt;br /&gt;
* 10-wire stranded ribbon cable&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Code ==&lt;br /&gt;
&lt;br /&gt;
[[AP_KS_GM-control_panel_code.c|Code for the control panel PIC]]&lt;br /&gt;
&lt;br /&gt;
[[AP_KS_GM-pov_code.c|Code for the display PIC]]&lt;br /&gt;
&lt;br /&gt;
[[AP_KS_GM-POVInput.java|Code for the PC applet]]&lt;br /&gt;
&lt;br /&gt;
== Results ==&lt;br /&gt;
=== Mode 1: Canned Response ===&lt;br /&gt;
In the first mode of operation, a user can just plug in the POV display into a wall socket, turn on the device and display an image immediately. This will allow a quick and easy demonstration without a computer. We have stored ten different responses on the PIC ROM sitting on the rotating display panel. Using a potentiometer, the device allow the user to set which canned response is being displayed.&lt;br /&gt;
&lt;br /&gt;
http://www.youtube.com/watch?v=zx5eXrf9oQI[http://www.youtube.com/watch?v=zx5eXrf9oQI]&lt;br /&gt;
&lt;br /&gt;
=== Mode 2: Real time image input ===&lt;br /&gt;
In the second mode of operation, a user can interact more closely with the POV display. In this mode, the POV  display is connected via a USB port to a computer which needs to have Java installed. The Java program with the code listed above allows a user to draw pictures or type letters which will be tranmitted real time from the control panel PIC to the rotating display panel PIC through the wireless Xbee chips.&lt;br /&gt;
&lt;br /&gt;
In both modes of operation, we have set up knobs that will allow a user to scroll a message manually or set the scroll speed of an image. &lt;br /&gt;
&lt;br /&gt;
http://www.youtube.com/watch?v=urz729AbkG4[http://www.youtube.com/watch?v=urz729AbkG4]&lt;br /&gt;
&lt;br /&gt;
== Additional Notes ==&lt;br /&gt;
=== Possible Future Improvements/Enhancements ===&lt;br /&gt;
We have thought about using RGB LEDS to give the display panel more colorful. Also, we can use different sensors to make the display more interactive. For example putting on distance sensors on the display so that the panel color scheme changes when you wave a hand in front of it.&lt;/div&gt;</summary>
		<author><name>Kwang Sim</name></author>
	</entry>
	<entry>
		<id>https://hades.mech.northwestern.edu//index.php?title=Persistence-of-Vision_Display&amp;diff=12195</id>
		<title>Persistence-of-Vision Display</title>
		<link rel="alternate" type="text/html" href="https://hades.mech.northwestern.edu//index.php?title=Persistence-of-Vision_Display&amp;diff=12195"/>
		<updated>2009-03-19T22:53:33Z</updated>

		<summary type="html">&lt;p&gt;Kwang Sim: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Overview ==&lt;br /&gt;
[[image:POV|right]]&lt;br /&gt;
A fully customizable display using the concept of Persistence of Vision was created as a final project for ME333 in 2009. User-specified images (and even moving images) were displayed by rotating a column of LEDs at speeds faster than 300rpm. Each individual LED was modeled as a row of pixels. Conversely, the rotational position of the panel of LEDs represented the pixel columns of the display; the time interval and rotational speed determined the width of the pixel columns.&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
* Gregory McGlynn (Computer Science, Class of 2011) [left]&lt;br /&gt;
* Kwang Xiong Sim (Mechanical Engineering, Class of 2010) [center]&lt;br /&gt;
* Alexander Park (Material Science and Engineering, Class of 2009) [right]&lt;br /&gt;
&lt;br /&gt;
=== Theory of Persistence of Vision ===&lt;br /&gt;
Although arguably much more complex, human vision functions in a manner similar to modern motion pictures; our eyes retain images for a fraction of a second, not unlike a frame in a movie. This is called persistence of vision (POV). When images change fast enough, what we see is a subtle blend of what we see now and a fraction of a second ago.&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
[[image:POVschematic|thumb|right|250px|Schematic of POV Display]]&lt;br /&gt;
In order to avoid the complication of wiring a spinning object, all of the major components of the POV display were placed on a platform mounted on the output shaft of a [[Actuators Available in the Mechatronics Lab#6W Maxon motor with 6:1 gearhead and 100 line encoder|6W Maxon motor]]. The components of this rotating platform include a [[PIC Microcontroller]], a panel of 14 bright white LEDs, a [[Hall Effect Sensor|Hall switch]], an [[XBee radio communication between PICs|XBee radio]], and a battery pack to power the assembly. The strip of LEDs was mounted vertically (or parallel to the axis of rotation) at one end of the platform. To minimize wobbling of the assembly while spinning, the components were positioned such that the center of gravity of the panel passed through the axis of rotation.&lt;br /&gt;
&lt;br /&gt;
Wireless communication between two PICs via [[XBee radio communication between PICs|XBees]] was used to enable live updating of the display based on user input: one PIC (the &amp;quot;display&amp;quot; PIC) was used to control the POV display and receive wireless information from a second PIC. This second &amp;quot;controller&amp;quot; PIC was used to receive user input and transmit it to the display PIC.&lt;br /&gt;
&lt;br /&gt;
=== Modes of Operation ===&lt;br /&gt;
The POV display has two modes of operation, corresponding to two different input methods. &lt;br /&gt;
&lt;br /&gt;
In the first mode of operation, the controller PIC transmits previously stored data to the PIC on the rotor panel. By varying the resistance of a [[Potentiometers|potentiometer]] on the control panel, the user can choose between eleven &amp;quot;canned&amp;quot; messages.&lt;br /&gt;
&lt;br /&gt;
In the second mode of operation, the controller PIC is connected to a computer via [[PIC RS232#FTDIChip TTL-232R USB to RS232 Cable|USB]]. Using a Java program written by Gregory McGlynn, the user can draw pictures or type letters in real time on the computer screen and on the POV display. &lt;br /&gt;
&lt;br /&gt;
=== Position Sensing ===&lt;br /&gt;
To allow for accurate portrayal of the desired image, a [[Hall Effect Sensor|Hall switch]] was utilized to implement position sensing. The Hall switch was mounted near the end of the rotor display platform and a magnet was attached on the top of the base box. The magnet was positioned directly under the path of the hall sensor such that each rotation of the platform triggered an electrical pulse. The display PIC was programmed to reset the image cycle each time a pulse was sensed from the Hall sensor. This allowed reproduction of a stationary image.&lt;br /&gt;
&lt;br /&gt;
Using this implementation of the Hall switch, the display POV was programmed to calculate the rotational velocity of the POV after each rotation by timing the interval between pulses from the Hall switch. This allows for correction of pixel column spacing, such that the column width is consistent even at different speeds. As such, the display may function properly without any information from the motor about its speed.&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Mechanical Design ==&lt;br /&gt;
[[image:POV_CADdrawing|right|thumb|250px|CAD representation of POV Display]]&lt;br /&gt;
=== Base ===&lt;br /&gt;
The base box was fabricated using black expanded PVC. There are three rectangular faces (the back, top, and bottom), two trapezoidal sides and a door that is hinged at the base such that it opens outwards. The control panel was mounted on the inner face of the door.&lt;br /&gt;
&lt;br /&gt;
A wooden base was mounted to the bottom of this PVC box both to increase the box&amp;#039;s integrity and to add to stability of the system with additional mass. A slot was cut near the back of the wooden panel to hold motor in place. &lt;br /&gt;
&lt;br /&gt;
The motor output shaft was connected to the POV display platform through an aluminum coupler. This coupler extended out the top of the box through a [[Bearings|radial ball bearing]], which served to reduce lateral motion of the display platform and to support some of the weight of the platform. The end of the coupler was machined to fit snugly  in to a slot-shaped hole in the display platform. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;Br&amp;gt;.&amp;lt;Br&amp;gt;.&amp;lt;Br&amp;gt;.&lt;br /&gt;
=== Control Panel ===&lt;br /&gt;
[[image:Picture of Control Panel|right|thumb|250px|Picture of Control Panel]]&lt;br /&gt;
Several knobs, buttons, and switches were placed on a control panel to allow for user input: 1) Motor power switch, 2) Motor speed knob, 3) Selection knob for stored responses, 4) Selection button for stored response, 5) Message position knob, and 6) Scroll speed knob. These components were mounted on a piece of expanded PVC through appropriately sized holes. Specifics on the implementation of these components are described below in the Electronic Design section.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;Br&amp;gt;.&amp;lt;Br&amp;gt;.&amp;lt;Br&amp;gt;.&amp;lt;Br&amp;gt;.&amp;lt;Br&amp;gt;.&lt;br /&gt;
=== Rotating Display Platform ===&lt;br /&gt;
[[image:Picture of Display Platform|right|thumb|250px|Picture of Display Platform]]&lt;br /&gt;
Because the display platform rotates rapidly during operation, all of the components were mounted rigidly onto two sheets of expanded PVC. These two sheets were screwed together at the center of the platform, such that a double layer of material was created at the slot for the motor coupler. At one end of the platform, the panel of 14 vertically mounted LEDs was mounted. The electronics of the platform (consisting of a solder board and a PIC board separated by standoffs) were mounted behind the LED panel. A 6V battery pack (4AA&amp;#039;s) was mounted at the opposite end of the platform with Velcro. This non-permanent positioning of the battery pack was chosen so that the batteries could be easily replaced and such that the batteries could act as an adjustable counterbalance for the entire platform.&lt;br /&gt;
&lt;br /&gt;
=== Parts List ===&lt;br /&gt;
* (1) [[Actuators Available in the Mechatronics Lab#6W Maxon motor with 6:1 gearhead and 100 line encoder|6W Maxon Motor]]&lt;br /&gt;
* (1) Toggle Switch&lt;br /&gt;
* (1) 25Ohm Potentiometer&lt;br /&gt;
* (1) Radial ball bearing&lt;br /&gt;
* Expanded PVC sheet&lt;br /&gt;
* Wood (approx. 6&amp;quot; x 5&amp;quot; x 0.5&amp;quot;)&lt;br /&gt;
* Sheet metal screws&lt;br /&gt;
* Various nuts and bolts&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Electrical Design ==&lt;br /&gt;
=== Display PIC Electronics ===&lt;br /&gt;
[[Image:POVschematicsmall.jpg|400px|right|Display circuit]]&lt;br /&gt;
The rotating display platform has 14 LEDs which were controlled through Ports C and D of a PIC. Because bright LEDs were used, the amount of current need could not be supplied directly from the output ports of the PIC. As such, the LEDs were wired through two Darlington arrays (DS2003). These ICs consist of 7 [[Diodes and Transistors#Darlington Pair|Darlington pairs]] with a common emitter. The outputs of the PIC were connected to the bases of the transistors; when the PIC drives one of the bases high, current can flow through the transistor and the corresponding LED lights up. We did not find it necessary to use any resistors in this design.&lt;br /&gt;
&lt;br /&gt;
The display uses a [[Hall Effect Sensor|Hall switch]] to synchronize its display with its rotation, as described above. The implemented circuit, as shown schematically at the right, causes pin B0 of the PIC to go low whenever the hall switch is near the magnet mounted on the base box; when the PIC detects this falling edge on pin B0 it knows its relative position. By timing the interval between two of these events the PIC calculates how fast the display is rotating and adjusts its timing accordingly.&lt;br /&gt;
&lt;br /&gt;
The display receives commands from the controller PIC via an [[XBee radio communication between PICs|XBee]] radio module.&lt;br /&gt;
&lt;br /&gt;
=== Controller PIC Electronics  ===&lt;br /&gt;
[[Image:AP_KS_GM=Control_panel_schematic.jpg|400px|right|Control panel circuit]]&lt;br /&gt;
When using the first mode of operation, the control panel receives user input through three potentiometers and a push button. The states of these controls are read by the PIC which uses its XBee radio module to send appropriate commands to the display.&lt;br /&gt;
&lt;br /&gt;
If the USB cable is plugged in, the control panel is also responsible for accepting commands from the PC and relaying these commands to the POV through the XBee.&lt;br /&gt;
&lt;br /&gt;
=== Parts list ===&lt;br /&gt;
* (2) PIC18F4520 microcontrollers&lt;br /&gt;
* (1) XBee Radio pair and their [[XBee Interface Board|interface boards]]&lt;br /&gt;
* (2) Darlington Pair Arrays (DS2003)&lt;br /&gt;
* (1) Hall switch&lt;br /&gt;
* (14) Bright white LEDs&lt;br /&gt;
* (3) 1000-Ohm potentiometers&lt;br /&gt;
* Push-button&lt;br /&gt;
* Solder Board&lt;br /&gt;
* Stranded wire&lt;br /&gt;
* 10-wire stranded ribbon cable&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Code ==&lt;br /&gt;
&lt;br /&gt;
[[AP_KS_GM-control_panel_code.c|Code for the control panel PIC]]&lt;br /&gt;
&lt;br /&gt;
[[AP_KS_GM-pov_code.c|Code for the display PIC]]&lt;br /&gt;
&lt;br /&gt;
[[AP_KS_GM-POVInput.java|Code for the PC applet]]&lt;br /&gt;
&lt;br /&gt;
== Results ==&lt;br /&gt;
=== Mode 1: Canned Response ===&lt;br /&gt;
In the first mode of operation, a user can just plug in the POV display into a wall socket, turn on the device and display an image immediately. This will allow a quick and easy demonstration without a computer. We have stored ten different responses on the PIC ROM sitting on the rotating display panel. Using a potentiometer, the device allow the user to set which canned response is being displayed.&lt;br /&gt;
&lt;br /&gt;
http://www.youtube.com/watch?v=zx5eXrf9oQI[http://www.youtube.com/watch?v=zx5eXrf9oQI]&lt;br /&gt;
&lt;br /&gt;
=== Mode 2: Real time image input ===&lt;br /&gt;
In the second mode of operation, a user can interact more closely with the POV display. In this mode, the POV  display is connected via a USB port to a computer which needs to have Java installed. The Java program with the code listed above allows a user to draw pictures or type letters which will be tranmitted real time from the control panel PIC to the rotating display panel PIC through the wireless Xbee chips.&lt;br /&gt;
&lt;br /&gt;
In both modes of operation, we have set up knobs that will allow a user to scroll a message manually or set the scroll speed of an image. &lt;br /&gt;
&lt;br /&gt;
http://www.youtube.com/watch?v=urz729AbkG4[http://www.youtube.com/watch?v=urz729AbkG4]&lt;br /&gt;
&lt;br /&gt;
== Additional Notes ==&lt;br /&gt;
=== Possible Future Improvements/Enhancements ===&lt;br /&gt;
We have thought about using RGB LEDS to give the display panel more colorful. Also, we can use different sensors to make the display more interactive. For example putting on distance sensors on the display so that the panel color scheme changes when you wave a hand in front of it.&lt;/div&gt;</summary>
		<author><name>Kwang Sim</name></author>
	</entry>
	<entry>
		<id>https://hades.mech.northwestern.edu//index.php?title=Persistence-of-Vision_Display&amp;diff=12193</id>
		<title>Persistence-of-Vision Display</title>
		<link rel="alternate" type="text/html" href="https://hades.mech.northwestern.edu//index.php?title=Persistence-of-Vision_Display&amp;diff=12193"/>
		<updated>2009-03-19T22:52:13Z</updated>

		<summary type="html">&lt;p&gt;Kwang Sim: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Overview ==&lt;br /&gt;
[[image:POV|right]]&lt;br /&gt;
A fully customizable display using the concept of Persistence of Vision was created as a final project for ME333 in 2009. User-specified images (and even moving images) were displayed by rotating a column of LEDs at speeds faster than 300rpm. Each individual LED was modeled as a row of pixels. Conversely, the rotational position of the panel of LEDs represented the pixel columns of the display; the time interval and rotational speed determined the width of the pixel columns.&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
* Gregory McGlynn (Computer Science, Class of 2011) [left]&lt;br /&gt;
* Kwang Xiong Sim (Mechanical Engineering, Class of 2010) [center]&lt;br /&gt;
* Alexander Park (Material Science and Engineering, Class of 2009) [right]&lt;br /&gt;
&lt;br /&gt;
=== Theory of Persistence of Vision ===&lt;br /&gt;
Although arguably much more complex, human vision functions in a manner similar to modern motion pictures; our eyes retain images for a fraction of a second, not unlike a frame in a movie. This is called persistence of vision (POV). When images change fast enough, what we see is a subtle blend of what we see now and a fraction of a second ago.&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
[[image:POVschematic|thumb|right|250px|Schematic of POV Display]]&lt;br /&gt;
In order to avoid the complication of wiring a spinning object, all of the major components of the POV display were placed on a platform mounted on the output shaft of a [[Actuators Available in the Mechatronics Lab#6W Maxon motor with 6:1 gearhead and 100 line encoder|6W Maxon motor]]. The components of this rotating platform include a [[PIC Microcontroller]], a panel of 14 bright white LEDs, a [[Hall Effect Sensor|Hall switch]], an [[XBee radio communication between PICs|XBee radio]], and a battery pack to power the assembly. The strip of LEDs was mounted vertically (or parallel to the axis of rotation) at one end of the platform. To minimize wobbling of the assembly while spinning, the components were positioned such that the center of gravity of the panel passed through the axis of rotation.&lt;br /&gt;
&lt;br /&gt;
Wireless communication between two PICs via [[XBee radio communication between PICs|XBees]] was used to enable live updating of the display based on user input: one PIC (the &amp;quot;display&amp;quot; PIC) was used to control the POV display and receive wireless information from a second PIC. This second &amp;quot;controller&amp;quot; PIC was used to receive user input and transmit it to the display PIC.&lt;br /&gt;
&lt;br /&gt;
=== Modes of Operation ===&lt;br /&gt;
The POV display has two modes of operation, corresponding to two different input methods. &lt;br /&gt;
&lt;br /&gt;
In the first mode of operation, the controller PIC transmits previously stored data to the PIC on the rotor panel. By varying the resistance of a [[Potentiometers|potentiometer]] on the control panel, the user can choose between eleven &amp;quot;canned&amp;quot; messages.&lt;br /&gt;
&lt;br /&gt;
In the second mode of operation, the controller PIC is connected to a computer via [[PIC RS232#FTDIChip TTL-232R USB to RS232 Cable|USB]]. Using a Java program written by Gregory McGlynn, the user can draw pictures or type letters in real time on the computer screen and on the POV display. &lt;br /&gt;
&lt;br /&gt;
=== Position Sensing ===&lt;br /&gt;
To allow for accurate portrayal of the desired image, a [[Hall Effect Sensor|Hall switch]] was utilized to implement position sensing. The Hall switch was mounted near the end of the rotor display platform and a magnet was attached on the top of the base box. The magnet was positioned directly under the path of the hall sensor such that each rotation of the platform triggered an electrical pulse. The display PIC was programmed to reset the image cycle each time a pulse was sensed from the Hall sensor. This allowed reproduction of a stationary image.&lt;br /&gt;
&lt;br /&gt;
Using this implementation of the Hall switch, the display POV was programmed to calculate the rotational velocity of the POV after each rotation by timing the interval between pulses from the Hall switch. This allows for correction of pixel column spacing, such that the column width is consistent even at different speeds. As such, the display may function properly without any information from the motor about its speed.&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Mechanical Design ==&lt;br /&gt;
[[image:POV_CADdrawing|right|thumb|250px|CAD representation of POV Display]]&lt;br /&gt;
=== Base ===&lt;br /&gt;
The base box was fabricated using black expanded PVC. There are three rectangular faces (the back, top, and bottom), two trapezoidal sides and a door that is hinged at the base such that it opens outwards. The control panel was mounted on the inner face of the door.&lt;br /&gt;
&lt;br /&gt;
A wooden base was mounted to the bottom of this PVC box both to increase the box&amp;#039;s integrity and to add to stability of the system with additional mass. A slot was cut near the back of the wooden panel to hold motor in place. &lt;br /&gt;
&lt;br /&gt;
The motor output shaft was connected to the POV display platform through an aluminum coupler. This coupler extended out the top of the box through a [[Bearings|radial ball bearing]], which served to reduce lateral motion of the display platform and to support some of the weight of the platform. The end of the coupler was machined to fit snugly  in to a slot-shaped hole in the display platform. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;Br&amp;gt;.&amp;lt;Br&amp;gt;.&amp;lt;Br&amp;gt;.&lt;br /&gt;
=== Control Panel ===&lt;br /&gt;
[[image:Picture of Control Panel|right|thumb|250px|Picture of Control Panel]]&lt;br /&gt;
Several knobs, buttons, and switches were placed on a control panel to allow for user input: 1) Motor power switch, 2) Motor speed knob, 3) Selection knob for stored responses, 4) Selection button for stored response, 5) Message position knob, and 6) Scroll speed knob. These components were mounted on a piece of expanded PVC through appropriately sized holes. Specifics on the implementation of these components are described below in the Electronic Design section.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;Br&amp;gt;.&amp;lt;Br&amp;gt;.&amp;lt;Br&amp;gt;.&amp;lt;Br&amp;gt;.&lt;br /&gt;
=== Rotating Display Platform ===&lt;br /&gt;
[[image:Picture of Display Platform|right|thumb|250px|Picture of Display Platform]]&lt;br /&gt;
Because the display platform rotates rapidly during operation, all of the components were mounted rigidly onto two sheets of expanded PVC. These two sheets were screwed together at the center of the platform, such that a double layer of material was created at the slot for the motor coupler. At one end of the platform, the panel of 14 vertically mounted LEDs was mounted. The electronics of the platform (consisting of a solder board and a PIC board separated by standoffs) were mounted behind the LED panel. A 6V battery pack (4AA&amp;#039;s) was mounted at the opposite end of the platform with Velcro. This non-permanent positioning of the battery pack was chosen so that the batteries could be easily replaced and such that the batteries could act as an adjustable counterbalance for the entire platform.&lt;br /&gt;
&lt;br /&gt;
=== Parts List ===&lt;br /&gt;
* (1) [[Actuators Available in the Mechatronics Lab#6W Maxon motor with 6:1 gearhead and 100 line encoder|6W Maxon Motor]]&lt;br /&gt;
* (1) Toggle Switch&lt;br /&gt;
* (1) 25Ohm Potentiometer&lt;br /&gt;
* (1) Radial ball bearing&lt;br /&gt;
* Expanded PVC sheet&lt;br /&gt;
* Wood (approx. 6&amp;quot; x 5&amp;quot; x 0.5&amp;quot;)&lt;br /&gt;
* Sheet metal screws&lt;br /&gt;
* Various nuts and bolts&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Electrical Design ==&lt;br /&gt;
=== Display PIC Electronics ===&lt;br /&gt;
[[Image:POVschematicsmall.jpg|400px|right|Display circuit]]&lt;br /&gt;
The rotating display platform has 14 LEDs which were controlled through Ports C and D of a PIC. Because bright LEDs were used, the amount of current need could not be supplied directly from the output ports of the PIC. As such, the LEDs were wired through two Darlington arrays (DS2003). These ICs consist of 7 [[Diodes and Transistors#Darlington Pair|Darlington pairs]] with a common emitter. The outputs of the PIC were connected to the bases of the transistors; when the PIC drives one of the bases high, current can flow through the transistor and the corresponding LED lights up. We did not find it necessary to use any resistors in this design.&lt;br /&gt;
&lt;br /&gt;
The display uses a [[Hall Effect Sensor|Hall switch]] to synchronize its display with its rotation, as described above. The implemented circuit, as shown schematically at the right, causes pin B0 of the PIC to go low whenever the hall switch is near the magnet mounted on the base box; when the PIC detects this falling edge on pin B0 it knows its relative position. By timing the interval between two of these events the PIC calculates how fast the display is rotating and adjusts its timing accordingly.&lt;br /&gt;
&lt;br /&gt;
The display receives commands from the controller PIC via an [[XBee radio communication between PICs|XBee]] radio module.&lt;br /&gt;
&lt;br /&gt;
=== Controller PIC Electronics  ===&lt;br /&gt;
[[Image:AP_KS_GM=Control_panel_schematic.jpg|400px|right|Control panel circuit]]&lt;br /&gt;
When using the first mode of operation, the control panel receives user input through three potentiometers and a push button. The states of these controls are read by the PIC which uses its XBee radio module to send appropriate commands to the display.&lt;br /&gt;
&lt;br /&gt;
If the USB cable is plugged in, the control panel is also responsible for accepting commands from the PC and relaying these commands to the POV through the XBee.&lt;br /&gt;
&lt;br /&gt;
=== Parts list ===&lt;br /&gt;
* (2) PIC18F4520 microcontrollers&lt;br /&gt;
* (1) XBee Radio pair and their [[XBee Interface Board|interface boards]]&lt;br /&gt;
* (2) Darlington Pair Arrays (DS2003)&lt;br /&gt;
* (1) Hall switch&lt;br /&gt;
* (14) Bright white LEDs&lt;br /&gt;
* (3) 1000-Ohm potentiometers&lt;br /&gt;
* Push-button&lt;br /&gt;
* Solder Board&lt;br /&gt;
* Stranded wire&lt;br /&gt;
* 10-wire stranded ribbon cable&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Code ==&lt;br /&gt;
&lt;br /&gt;
[[AP_KS_GM-control_panel_code.c|Code for the control panel PIC]]&lt;br /&gt;
&lt;br /&gt;
[[AP_KS_GM-pov_code.c|Code for the display PIC]]&lt;br /&gt;
&lt;br /&gt;
[[AP_KS_GM-POVInput.java|Code for the PC applet]]&lt;br /&gt;
&lt;br /&gt;
== Results ==&lt;br /&gt;
=== Mode 1: Canned Response ===&lt;br /&gt;
In the first mode of operation, a user can just plug in the POV display into a wall socket, turn on the device and display an image immediately. This will allow a quick and easy demonstration without a computer. We have stored ten different responses on the PIC ROM sitting on the rotating display panel. Using a potentiometer, the device allow the user to set which canned response is being displayed.&lt;br /&gt;
&lt;br /&gt;
http://www.youtube.com/watch?v=zx5eXrf9oQI[http://www.youtube.com/watch?v=zx5eXrf9oQI]&lt;br /&gt;
&lt;br /&gt;
=== Mode 2: Real time image input ===&lt;br /&gt;
In the second mode of operation, a user can interact more closely with the POV display. In this mode, the POV  display is connected via a USB port to a computer which needs to have Java installed. The Java program with the code listed above allows a user to draw pictures or type letters which will be tranmitted real time from the control panel PIC to the rotating display panel PIC through the wireless Xbee chips.&lt;br /&gt;
&lt;br /&gt;
In both modes of operation, we have set up knobs that will allow a user to scroll a message manually or set the scroll speed of an image. &lt;br /&gt;
&lt;br /&gt;
http://www.youtube.com/watch?v=urz729AbkG4[http://www.youtube.com/watch?v=urz729AbkG4]&lt;br /&gt;
&lt;br /&gt;
== Additional Notes ==&lt;br /&gt;
=== Possible Future Improvements/Enhancements ===&lt;br /&gt;
We have thought about using RGB LEDS to give the display panel more colorful. Also, we can use different sensors to make the display more interactive. For example putting on distance sensors on the display so that the panel color scheme changes when you wave a hand in front of it.&lt;/div&gt;</summary>
		<author><name>Kwang Sim</name></author>
	</entry>
	<entry>
		<id>https://hades.mech.northwestern.edu//index.php?title=Persistence-of-Vision_Display&amp;diff=12187</id>
		<title>Persistence-of-Vision Display</title>
		<link rel="alternate" type="text/html" href="https://hades.mech.northwestern.edu//index.php?title=Persistence-of-Vision_Display&amp;diff=12187"/>
		<updated>2009-03-19T22:48:48Z</updated>

		<summary type="html">&lt;p&gt;Kwang Sim: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Overview ==&lt;br /&gt;
[[image:POV|right]]&lt;br /&gt;
A fully customizable display using the concept of Persistence of Vision was created as a final project for ME333 in 2009. User-specified images (and even moving images) were displayed by rotating a column of LEDs at speeds faster than 300rpm. Each individual LED was modeled as a row of pixels. Conversely, the rotational position of the panel of LEDs represented the pixel columns of the display; the time interval and rotational speed determined the width of the pixel columns.&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
* Gregory McGlynn (Computer Science, Class of 2011) [left]&lt;br /&gt;
* Kwang Xiong Sim (Mechanical Engineering, Class of 2010) [center]&lt;br /&gt;
* Alexander Park (Material Science and Engineering, Class of 2009) [right]&lt;br /&gt;
&lt;br /&gt;
=== Theory of Persistence of Vision ===&lt;br /&gt;
Although arguably much more complex, human vision functions in a manner similar to modern motion pictures; our eyes retain images for a fraction of a second, not unlike a frame in a movie. This is called persistence of vision (POV). When images change fast enough, what we see is a subtle blend of what we see now and a fraction of a second ago.&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
[[image:POVschematic|thumb|right|250px|Schematic of POV Display]]&lt;br /&gt;
In order to avoid the complication of wiring a spinning object, all of the major components of the POV display were placed on a platform mounted on the output shaft of a [[Actuators Available in the Mechatronics Lab#6W Maxon motor with 6:1 gearhead and 100 line encoder|6W Maxon motor]]. The components of this rotating platform include a [[PIC Microcontroller]], a panel of 14 bright white LEDs, a [[Hall Effect Sensor|Hall switch]], an [[XBee radio communication between PICs|XBee radio]], and a battery pack to power the assembly. The strip of LEDs was mounted vertically (or parallel to the axis of rotation) at one end of the platform. To minimize wobbling of the assembly while spinning, the components were positioned such that the center of gravity of the panel passed through the axis of rotation.&lt;br /&gt;
&lt;br /&gt;
Wireless communication between two PICs via [[XBee radio communication between PICs|XBees]] was used to enable live updating of the display based on user input: one PIC (the &amp;quot;display&amp;quot; PIC) was used to control the POV display and receive wireless information from a second PIC. This second &amp;quot;controller&amp;quot; PIC was used to receive user input and transmit it to the display PIC.&lt;br /&gt;
&lt;br /&gt;
=== Modes of Operation ===&lt;br /&gt;
The POV display has two modes of operation, corresponding to two different input methods. &lt;br /&gt;
&lt;br /&gt;
In the first mode of operation, the controller PIC transmits previously stored data to the PIC on the rotor panel. By varying the resistance of a [[Potentiometers|potentiometer]] on the control panel, the user can choose between eleven &amp;quot;canned&amp;quot; messages.&lt;br /&gt;
&lt;br /&gt;
In the second mode of operation, the controller PIC is connected to a computer via [[PIC RS232#FTDIChip TTL-232R USB to RS232 Cable|USB]]. Using a Java program written by Gregory McGlynn, the user can draw pictures or type letters in real time on the computer screen and on the POV display. &lt;br /&gt;
&lt;br /&gt;
=== Position Sensing ===&lt;br /&gt;
To allow for accurate portrayal of the desired image, a [[Hall Effect Sensor|Hall switch]] was utilized to implement position sensing. The Hall switch was mounted near the end of the rotor display platform and a magnet was attached on the top of the base box. The magnet was positioned directly under the path of the hall sensor such that each rotation of the platform triggered an electrical pulse. The display PIC was programmed to reset the image cycle each time a pulse was sensed from the Hall sensor. This allowed reproduction of a stationary image.&lt;br /&gt;
&lt;br /&gt;
Using this implementation of the Hall switch, the display POV was programmed to calculate the rotational velocity of the POV after each rotation by timing the interval between pulses from the Hall switch. This allows for correction of pixel column spacing, such that the column width is consistent even at different speeds. As such, the display may function properly without any information from the motor about its speed.&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Mechanical Design ==&lt;br /&gt;
[[image:POV_CADdrawing|right|thumb|250px|CAD representation of POV Display]]&lt;br /&gt;
=== Base ===&lt;br /&gt;
The base box was fabricated using black expanded PVC. There are three rectangular faces (the back, top, and bottom), two trapezoidal sides and a door that is hinged at the base such that it opens outwards. The control panel was mounted on the inner face of the door.&lt;br /&gt;
&lt;br /&gt;
A wooden base was mounted to the bottom of this PVC box both to increase the box&amp;#039;s integrity and to add to stability of the system with additional mass. A slot was cut near the back of the wooden panel to hold motor in place. &lt;br /&gt;
&lt;br /&gt;
The motor output shaft was connected to the POV display platform through an aluminum coupler. This coupler extended out the top of the box through a [[Bearings|radial ball bearing]], which served to reduce lateral motion of the display platform and to support some of the weight of the platform. The end of the coupler was machined to fit snugly  in to a slot-shaped hole in the display platform. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;Br&amp;gt;.&amp;lt;Br&amp;gt;.&amp;lt;Br&amp;gt;.&lt;br /&gt;
=== Control Panel ===&lt;br /&gt;
[[image:Picture of Control Panel|right|thumb|250px|Picture of Control Panel]]&lt;br /&gt;
Several knobs, buttons, and switches were placed on a control panel to allow for user input: 1) Motor power switch, 2) Motor speed knob, 3) Selection knob for stored responses, 4) Selection button for stored response, 5) Message position knob, and 6) Scroll speed knob. These components were mounted on a piece of expanded PVC through appropriately sized holes. Specifics on the implementation of these components are described below in the Electronic Design section.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;Br&amp;gt;.&amp;lt;Br&amp;gt;.&amp;lt;Br&amp;gt;.&lt;br /&gt;
=== Display Platform ===&lt;br /&gt;
[[image:Picture of Display Platform|right|thumb|250px|Picture of Display Platform]]&lt;br /&gt;
Because the display platform rotates rapidly during operation, all of the components were mounted rigidly onto two sheets of expanded PVC. These two sheets were screwed together at the center of the platform, such that a double layer of material was created at the slot for the motor coupler. At one end of the platform, the panel of 14 vertically mounted LEDs was mounted. The electronics of the platform (consisting of a solder board and a PIC board separated by standoffs) were mounted behind the LED panel. A 6V battery pack (4AA&amp;#039;s) was mounted at the opposite end of the platform with Velcro. This non-permanent positioning of the battery pack was chosen so that the batteries could be easily replaced and such that the batteries could act as an adjustable counterbalance for the entire platform.&lt;br /&gt;
&lt;br /&gt;
=== Parts List ===&lt;br /&gt;
* (1) [[Actuators Available in the Mechatronics Lab#6W Maxon motor with 6:1 gearhead and 100 line encoder|6W Maxon Motor]]&lt;br /&gt;
* (1) Toggle Switch&lt;br /&gt;
* (1) 25Ohm Potentiometer&lt;br /&gt;
* (1) Radial ball bearing&lt;br /&gt;
* Expanded PVC sheet&lt;br /&gt;
* Wood (approx. 6&amp;quot; x 5&amp;quot; x 0.5&amp;quot;)&lt;br /&gt;
* Sheet metal screws&lt;br /&gt;
* Various nuts and bolts&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Electrical Design ==&lt;br /&gt;
=== Display PIC Electronics ===&lt;br /&gt;
[[Image:POVschematicsmall.jpg|400px|right|Display circuit]]&lt;br /&gt;
The rotating display platform has 14 LEDs which were controlled through Ports C and D of a PIC. Because bright LEDs were used, the amount of current need could not be supplied directly from the output ports of the PIC. As such, the LEDs were wired through two Darlington arrays (DS2003). These ICs consist of 7 [[Diodes and Transistors#Darlington Pair|Darlington pairs]] with a common emitter. The outputs of the PIC were connected to the bases of the transistors; when the PIC drives one of the bases high, current can flow through the transistor and the corresponding LED lights up. We did not find it necessary to use any resistors in this design.&lt;br /&gt;
&lt;br /&gt;
The display uses a [[Hall Effect Sensor|Hall switch]] to synchronize its display with its rotation, as described above. The implemented circuit, as shown schematically at the right, causes pin B0 of the PIC to go low whenever the hall switch is near the magnet mounted on the base box; when the PIC detects this falling edge on pin B0 it knows its relative position. By timing the interval between two of these events the PIC calculates how fast the display is rotating and adjusts its timing accordingly.&lt;br /&gt;
&lt;br /&gt;
The display receives commands from the controller PIC via an [[XBee radio communication between PICs|XBee]] radio module.&lt;br /&gt;
&lt;br /&gt;
=== Controller PIC Electronics  ===&lt;br /&gt;
[[Image:AP_KS_GM=Control_panel_schematic.jpg|400px|right|Control panel circuit]]&lt;br /&gt;
When using the first mode of operation, the control panel receives user input through three potentiometers and a push button. The states of these controls are read by the PIC which uses its XBee radio module to send appropriate commands to the display.&lt;br /&gt;
&lt;br /&gt;
If the USB cable is plugged in, the control panel is also responsible for accepting commands from the PC and relaying these commands to the POV through the XBee.&lt;br /&gt;
&lt;br /&gt;
=== Parts list ===&lt;br /&gt;
* (2) PIC18F4520 microcontrollers&lt;br /&gt;
* (1) XBee Radio pair and their [[XBee Interface Board|interface boards]]&lt;br /&gt;
* (2) Darlington Pair Arrays (DS2003)&lt;br /&gt;
* (1) Hall switch&lt;br /&gt;
* (14) Bright white LEDs&lt;br /&gt;
* (3) 1000-Ohm potentiometers&lt;br /&gt;
* Push-button&lt;br /&gt;
* Solder Board&lt;br /&gt;
* Stranded wire&lt;br /&gt;
* 10-wire stranded ribbon cable&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Code ==&lt;br /&gt;
&lt;br /&gt;
[[AP_KS_GM-control_panel_code.c|Code for the control panel PIC]]&lt;br /&gt;
&lt;br /&gt;
[[AP_KS_GM-pov_code.c|Code for the display PIC]]&lt;br /&gt;
&lt;br /&gt;
[[AP_KS_GM-POVInput.java|Code for the PC applet]]&lt;br /&gt;
&lt;br /&gt;
== Results ==&lt;br /&gt;
=== Mode 1: Canned Response ===&lt;br /&gt;
In the first mode of operation, a user can just plug in the POV display into a wall socket, turn on the device and display an image immediately. This will allow a quick and easy demonstration without a computer. We have stored ten different responses on the PIC ROM sitting on the rotating display panel. Using a potentiometer, the device allow the user to set which canned response is being displayed.&lt;br /&gt;
&lt;br /&gt;
http://www.youtube.com/watch?v=zx5eXrf9oQI[http://www.youtube.com/watch?v=zx5eXrf9oQI]&lt;br /&gt;
&lt;br /&gt;
=== Mode 2: Real time image input ===&lt;br /&gt;
In the second mode of operation, a user can interact more closely with the POV display. In this mode, the POV  display is connected via a USB port to a computer which needs to have Java installed. The Java program with the code listed above allows a user to draw pictures or type letters which will be tranmitted real time from the control panel PIC to the rotating display panel PIC through the wireless Xbee chips.&lt;br /&gt;
&lt;br /&gt;
In both modes of operation, we have set up knobs that will allow a user to scroll a message manually or set the scroll speed of an image. &lt;br /&gt;
&lt;br /&gt;
http://www.youtube.com/watch?v=urz729AbkG4[http://www.youtube.com/watch?v=urz729AbkG4]&lt;br /&gt;
&lt;br /&gt;
== Additional Notes ==&lt;br /&gt;
=== Possible Future Improvements/Enhancements ===&lt;br /&gt;
We have thought about using RGB LEDS to give the display panel more colorful. Also, we can use different sensors to make the display more interactive. For example putting on distance sensors on the display so that the panel color scheme changes when you wave a hand in front of it.&lt;/div&gt;</summary>
		<author><name>Kwang Sim</name></author>
	</entry>
	<entry>
		<id>https://hades.mech.northwestern.edu//index.php?title=Persistence-of-Vision_Display&amp;diff=12184</id>
		<title>Persistence-of-Vision Display</title>
		<link rel="alternate" type="text/html" href="https://hades.mech.northwestern.edu//index.php?title=Persistence-of-Vision_Display&amp;diff=12184"/>
		<updated>2009-03-19T22:48:11Z</updated>

		<summary type="html">&lt;p&gt;Kwang Sim: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Overview ==&lt;br /&gt;
[[image:POV|right]]&lt;br /&gt;
A fully customizable display using the concept of Persistence of Vision was created as a final project for ME333 in 2009. User-specified images (and even moving images) were displayed by rotating a column of LEDs at speeds faster than 300rpm. Each individual LED was modeled as a row of pixels. Conversely, the rotational position of the panel of LEDs represented the pixel columns of the display; the time interval and rotational speed determined the width of the pixel columns.&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
* Gregory McGlynn (Computer Science, Class of 2011) [left]&lt;br /&gt;
* Kwang Xiong Sim (Mechanical Engineering, Class of 2010) [center]&lt;br /&gt;
* Alexander Park (Material Science and Engineering, Class of 2009) [right]&lt;br /&gt;
&lt;br /&gt;
=== Theory of Persistence of Vision ===&lt;br /&gt;
Although arguably much more complex, human vision functions in a manner similar to modern motion pictures; our eyes retain images for a fraction of a second, not unlike a frame in a movie. This is called persistence of vision (POV). When images change fast enough, what we see is a subtle blend of what we see now and a fraction of a second ago.&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
[[image:POVschematic|thumb|right|250px|Schematic of POV Display]]&lt;br /&gt;
In order to avoid the complication of wiring a spinning object, all of the major components of the POV display were placed on a platform mounted on the output shaft of a [[Actuators Available in the Mechatronics Lab#6W Maxon motor with 6:1 gearhead and 100 line encoder|6W Maxon motor]]. The components of this rotating platform include a [[PIC Microcontroller]], a panel of 14 bright white LEDs, a [[Hall Effect Sensor|Hall switch]], an [[XBee radio communication between PICs|XBee radio]], and a battery pack to power the assembly. The strip of LEDs was mounted vertically (or parallel to the axis of rotation) at one end of the platform. To minimize wobbling of the assembly while spinning, the components were positioned such that the center of gravity of the panel passed through the axis of rotation.&lt;br /&gt;
&lt;br /&gt;
Wireless communication between two PICs via [[XBee radio communication between PICs|XBees]] was used to enable live updating of the display based on user input: one PIC (the &amp;quot;display&amp;quot; PIC) was used to control the POV display and receive wireless information from a second PIC. This second &amp;quot;controller&amp;quot; PIC was used to receive user input and transmit it to the display PIC.&lt;br /&gt;
&lt;br /&gt;
=== Modes of Operation ===&lt;br /&gt;
The POV display has two modes of operation, corresponding to two different input methods. &lt;br /&gt;
&lt;br /&gt;
In the first mode of operation, the controller PIC transmits previously stored data to the PIC on the rotor panel. By varying the resistance of a [[Potentiometers|potentiometer]] on the control panel, the user can choose between eleven &amp;quot;canned&amp;quot; messages.&lt;br /&gt;
&lt;br /&gt;
In the second mode of operation, the controller PIC is connected to a computer via [[PIC RS232#FTDIChip TTL-232R USB to RS232 Cable|USB]]. Using a Java program written by Gregory McGlynn, the user can draw pictures or type letters in real time on the computer screen and on the POV display. &lt;br /&gt;
&lt;br /&gt;
=== Position Sensing ===&lt;br /&gt;
To allow for accurate portrayal of the desired image, a [[Hall Effect Sensor|Hall switch]] was utilized to implement position sensing. The Hall switch was mounted near the end of the rotor display platform and a magnet was attached on the top of the base box. The magnet was positioned directly under the path of the hall sensor such that each rotation of the platform triggered an electrical pulse. The display PIC was programmed to reset the image cycle each time a pulse was sensed from the Hall sensor. This allowed reproduction of a stationary image.&lt;br /&gt;
&lt;br /&gt;
Using this implementation of the Hall switch, the display POV was programmed to calculate the rotational velocity of the POV after each rotation by timing the interval between pulses from the Hall switch. This allows for correction of pixel column spacing, such that the column width is consistent even at different speeds. As such, the display may function properly without any information from the motor about its speed.&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Mechanical Design ==&lt;br /&gt;
[[image:POV_CADdrawing|right|thumb|250px|CAD representation of POV Display]]&lt;br /&gt;
=== Base ===&lt;br /&gt;
The base box was fabricated using black expanded PVC. There are three rectangular faces (the back, top, and bottom), two trapezoidal sides and a door that is hinged at the base such that it opens outwards. The control panel was mounted on the inner face of the door.&lt;br /&gt;
&lt;br /&gt;
A wooden base was mounted to the bottom of this PVC box both to increase the box&amp;#039;s integrity and to add to stability of the system with additional mass. A slot was cut near the back of the wooden panel to hold motor in place. &lt;br /&gt;
&lt;br /&gt;
The motor output shaft was connected to the POV display platform through an aluminum coupler. This coupler extended out the top of the box through a [[Bearings|radial ball bearing]], which served to reduce lateral motion of the display platform and to support some of the weight of the platform. The end of the coupler was machined to fit snugly  in to a slot-shaped hole in the display platform. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;Br&amp;gt;.&amp;lt;Br&amp;gt;.&amp;lt;Br&amp;gt;.&lt;br /&gt;
=== Control Panel ===&lt;br /&gt;
[[image:Picture of Control Panel|right|thumb|250px|Picture of Control Panel]]&lt;br /&gt;
Several knobs, buttons, and switches were placed on a control panel to allow for user input: 1) Motor power switch, 2) Motor speed knob, 3) Selection knob for stored responses, 4) Selection button for stored response, 5) Message position knob, and 6) Scroll speed knob. These components were mounted on a piece of expanded PVC through appropriately sized holes. Specifics on the implementation of these components are described below in the Electronic Design section.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;Br&amp;gt;.&amp;lt;Br&amp;gt;.&lt;br /&gt;
=== Display Platform ===&lt;br /&gt;
[[image:Picture of Display Platform|right|thumb|250px|Picture of Display Platform]]&lt;br /&gt;
Because the display platform rotates rapidly during operation, all of the components were mounted rigidly onto two sheets of expanded PVC. These two sheets were screwed together at the center of the platform, such that a double layer of material was created at the slot for the motor coupler. At one end of the platform, the panel of 14 vertically mounted LEDs was mounted. The electronics of the platform (consisting of a solder board and a PIC board separated by standoffs) were mounted behind the LED panel. A 6V battery pack (4AA&amp;#039;s) was mounted at the opposite end of the platform with Velcro. This non-permanent positioning of the battery pack was chosen so that the batteries could be easily replaced and such that the batteries could act as an adjustable counterbalance for the entire platform.&lt;br /&gt;
&lt;br /&gt;
=== Parts List ===&lt;br /&gt;
* (1) [[Actuators Available in the Mechatronics Lab#6W Maxon motor with 6:1 gearhead and 100 line encoder|6W Maxon Motor]]&lt;br /&gt;
* (1) Toggle Switch&lt;br /&gt;
* (1) 25Ohm Potentiometer&lt;br /&gt;
* (1) Radial ball bearing&lt;br /&gt;
* Expanded PVC sheet&lt;br /&gt;
* Wood (approx. 6&amp;quot; x 5&amp;quot; x 0.5&amp;quot;)&lt;br /&gt;
* Sheet metal screws&lt;br /&gt;
* Various nuts and bolts&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Electrical Design ==&lt;br /&gt;
=== Display Platform Electronics ===&lt;br /&gt;
[[Image:POVschematicsmall.jpg|400px|right|Display circuit]]&lt;br /&gt;
The rotating display platform has 14 LEDs which were controlled through Ports C and D of a PIC. Because bright LEDs were used, the amount of current need could not be supplied directly from the output ports of the PIC. As such, the LEDs were wired through two Darlington arrays (DS2003). These ICs consist of 7 [[Diodes and Transistors#Darlington Pair|Darlington pairs]] with a common emitter. The outputs of the PIC were connected to the bases of the transistors; when the PIC drives one of the bases high, current can flow through the transistor and the corresponding LED lights up. We did not find it necessary to use any resistors in this design.&lt;br /&gt;
&lt;br /&gt;
The display uses a [[Hall Effect Sensor|Hall switch]] to synchronize its display with its rotation, as described above. The implemented circuit, as shown schematically at the right, causes pin B0 of the PIC to go low whenever the hall switch is near the magnet mounted on the base box; when the PIC detects this falling edge on pin B0 it knows its relative position. By timing the interval between two of these events the PIC calculates how fast the display is rotating and adjusts its timing accordingly.&lt;br /&gt;
&lt;br /&gt;
The display receives commands via an [[XBee radio communication between PICs|XBee]] radio module.&lt;br /&gt;
&lt;br /&gt;
=== Control Panel Circuit ===&lt;br /&gt;
[[Image:AP_KS_GM=Control_panel_schematic.jpg|400px|right|Control panel circuit]]&lt;br /&gt;
&lt;br /&gt;
The control panel receives user input through three potentiometers and a pushbutton. The states of these controls are read by the PIC which uses its XBee radio module to send appropriate commands to the display.&lt;br /&gt;
&lt;br /&gt;
If the USB cable is plugged in, the control panel is also responsible for accepting commands from the PC and relaying these commands to the POV through the XBee.&lt;br /&gt;
&lt;br /&gt;
=== Parts list ===&lt;br /&gt;
* (2) PIC18F4520 microcontrollers&lt;br /&gt;
* (1) XBee Radio pair and their [[XBee Interface Board|interface boards]]&lt;br /&gt;
* (2) Darlington Pair Arrays (DS2003)&lt;br /&gt;
* (1) Hall switch&lt;br /&gt;
* (14) Bright white LEDs&lt;br /&gt;
* (3) 1000Ohm potentiometers&lt;br /&gt;
* (1) 25Ohm Potentiometer&lt;br /&gt;
* Push-button&lt;br /&gt;
* Solder Board&lt;br /&gt;
* Stranded wire&lt;br /&gt;
* 10-wire stranded ribbon cable&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Code ==&lt;br /&gt;
&lt;br /&gt;
[[AP_KS_GM-control_panel_code.c|Code for the control panel PIC]]&lt;br /&gt;
&lt;br /&gt;
[[AP_KS_GM-pov_code.c|Code for the display PIC]]&lt;br /&gt;
&lt;br /&gt;
[[AP_KS_GM-POVInput.java|Code for the PC applet]]&lt;br /&gt;
&lt;br /&gt;
== Results ==&lt;br /&gt;
=== Mode 1: Canned Response ===&lt;br /&gt;
In the first mode of operation, a user can just plug in the POV display into a wall socket, turn on the device and display an image immediately. This will allow a quick and easy demonstration without a computer. We have stored ten different responses on the PIC ROM sitting on the rotating display panel. Using a potentiometer, the device allow the user to set which canned response is being displayed.&lt;br /&gt;
&lt;br /&gt;
http://www.youtube.com/watch?v=zx5eXrf9oQI[http://www.youtube.com/watch?v=zx5eXrf9oQI]&lt;br /&gt;
&lt;br /&gt;
=== Mode 2: Real time image input ===&lt;br /&gt;
In the second mode of operation, a user can interact more closely with the POV display. In this mode, the POV  display is connected via a USB port to a computer which needs to have Java installed. The Java program with the code listed above allows a user to draw pictures or type letters which will be tranmitted real time from the control panel PIC to the rotating display panel PIC through the wireless Xbee chips.&lt;br /&gt;
&lt;br /&gt;
In both modes of operation, we have set up knobs that will allow a user to scroll a message manually or set the scroll speed of an image. &lt;br /&gt;
&lt;br /&gt;
http://www.youtube.com/watch?v=urz729AbkG4[http://www.youtube.com/watch?v=urz729AbkG4]&lt;br /&gt;
&lt;br /&gt;
== Additional Notes ==&lt;br /&gt;
=== Possible Future Improvements/Enhancements ===&lt;br /&gt;
We have thought about using RGB LEDS to give the display panel more colorful. Also, we can use different sensors to make the display more interactive. For example putting on distance sensors on the display so that the panel color scheme changes when you wave a hand in front of it.&lt;/div&gt;</summary>
		<author><name>Kwang Sim</name></author>
	</entry>
	<entry>
		<id>https://hades.mech.northwestern.edu//index.php?title=Persistence-of-Vision_Display&amp;diff=12181</id>
		<title>Persistence-of-Vision Display</title>
		<link rel="alternate" type="text/html" href="https://hades.mech.northwestern.edu//index.php?title=Persistence-of-Vision_Display&amp;diff=12181"/>
		<updated>2009-03-19T22:47:06Z</updated>

		<summary type="html">&lt;p&gt;Kwang Sim: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Overview ==&lt;br /&gt;
[[image:POV|right]]&lt;br /&gt;
A fully customizable display using the concept of Persistence of Vision was created as a final project for ME333 in 2009. User-specified images (and even moving images) were displayed by rotating a column of LEDs at speeds faster than 300rpm. Each individual LED was modeled as a row of pixels. Conversely, the rotational position of the panel of LEDs represented the pixel columns of the display; the time interval and rotational speed determined the width of the pixel columns.&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
* Gregory McGlynn (Computer Science, Class of 2011) [left]&lt;br /&gt;
* Kwang Xiong Sim (Mechanical Engineering, Class of 2010) [center]&lt;br /&gt;
* Alexander Park (Material Science and Engineering, Class of 2009) [right]&lt;br /&gt;
&lt;br /&gt;
=== Theory of Persistence of Vision ===&lt;br /&gt;
Although arguably much more complex, human vision functions in a manner similar to modern motion pictures; our eyes retain images for a fraction of a second, not unlike a frame in a movie. This is called persistence of vision (POV). When images change fast enough, what we see is a subtle blend of what we see now and a fraction of a second ago.&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
[[image:POVschematic|thumb|right|250px|Schematic of POV Display]]&lt;br /&gt;
In order to avoid the complication of wiring a spinning object, all of the major components of the POV display were placed on a platform mounted on the output shaft of a [[Actuators Available in the Mechatronics Lab#6W Maxon motor with 6:1 gearhead and 100 line encoder|6W Maxon motor]]. The components of this rotating platform include a [[PIC Microcontroller]], a panel of 14 bright white LEDs, a [[Hall Effect Sensor|Hall switch]], an [[XBee radio communication between PICs|XBee radio]], and a battery pack to power the assembly. The strip of LEDs was mounted vertically (or parallel to the axis of rotation) at one end of the platform. To minimize wobbling of the assembly while spinning, the components were positioned such that the center of gravity of the panel passed through the axis of rotation.&lt;br /&gt;
&lt;br /&gt;
Wireless communication between two PICs via [[XBee radio communication between PICs|XBees]] was used to enable live updating of the display based on user input: one PIC (the &amp;quot;display&amp;quot; PIC) was used to control the POV display and receive wireless information from a second PIC. This second &amp;quot;controller&amp;quot; PIC was used to receive user input and transmit it to the display PIC.&lt;br /&gt;
&lt;br /&gt;
=== Modes of Operation ===&lt;br /&gt;
The POV display has two modes of operation, corresponding to two different input methods. &lt;br /&gt;
&lt;br /&gt;
In the first mode of operation, the controller PIC transmits previously stored data to the PIC on the rotor panel. By varying the resistance of a [[Potentiometers|potentiometer]] on the control panel, the user can choose between eleven &amp;quot;canned&amp;quot; messages.&lt;br /&gt;
&lt;br /&gt;
In the second mode of operation, the controller PIC is connected to a computer via [[PIC RS232#FTDIChip TTL-232R USB to RS232 Cable|USB]]. Using a Java program written by Gregory McGlynn, the user can draw pictures or type letters in real time on the computer screen and on the POV display. &lt;br /&gt;
&lt;br /&gt;
=== Position Sensing ===&lt;br /&gt;
To allow for accurate portrayal of the desired image, a [[Hall Effect Sensor|Hall switch]] was utilized to implement position sensing. The Hall switch was mounted near the end of the rotor display platform and a magnet was attached on the top of the base box. The magnet was positioned directly under the path of the hall sensor such that each rotation of the platform triggered an electrical pulse. The display PIC was programmed to reset the image cycle each time a pulse was sensed from the Hall sensor. This allowed reproduction of a stationary image.&lt;br /&gt;
&lt;br /&gt;
Using this implementation of the Hall switch, the display POV was programmed to calculate the rotational velocity of the POV after each rotation by timing the interval between pulses from the Hall switch. This allows for correction of pixel column spacing, such that the column width is consistent even at different speeds. As such, the display may function properly without any information from the motor about its speed.&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Mechanical Design ==&lt;br /&gt;
[[image:POV_CADdrawing|right|thumb|250px|CAD representation of POV Display]]&lt;br /&gt;
=== Base ===&lt;br /&gt;
The base box was fabricated using black expanded PVC. There are three rectangular faces (the back, top, and bottom), two trapezoidal sides and a door that is hinged at the base such that it opens outwards. The control panel was mounted on the inner face of the door.&lt;br /&gt;
&lt;br /&gt;
A wooden base was mounted to the bottom of this PVC box both to increase the box&amp;#039;s integrity and to add to stability of the system with additional mass. A slot was cut near the back of the wooden panel to hold motor in place. &lt;br /&gt;
&lt;br /&gt;
The motor output shaft was connected to the POV display platform through an aluminum coupler. This coupler extended out the top of the box through a [[Bearings|radial ball bearing]], which served to reduce lateral motion of the display platform and to support some of the weight of the platform. The end of the coupler was machined to fit snugly  in to a slot-shaped hole in the display platform. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;Br&amp;gt;.&amp;lt;Br&amp;gt;.&lt;br /&gt;
=== Control Panel ===&lt;br /&gt;
[[image:Picture of Control Panel|right|thumb|250px|Picture of Control Panel]]&lt;br /&gt;
Several knobs, buttons, and switches were placed on a control panel to allow for user input: 1) Motor power switch, 2) Motor speed knob, 3) Selection knob for stored responses, 4) Selection button for stored response, 5) Message position knob, and 6) Scroll speed knob. These components were mounted on a piece of expanded PVC through appropriately sized holes. Specifics on the implementation of these components are described below in the Electronic Design section.&lt;br /&gt;
&lt;br /&gt;
=== Display Platform ===&lt;br /&gt;
[[image:Picture of Display Platform|right|thumb|250px|Picture of Display Platform]]&lt;br /&gt;
Because the display platform rotates rapidly during operation, all of the components were mounted rigidly onto two sheets of expanded PVC. These two sheets were screwed together at the center of the platform, such that a double layer of material was created at the slot for the motor coupler. At one end of the platform, the panel of 14 vertically mounted LEDs was mounted. The electronics of the platform (consisting of a solder board and a PIC board separated by standoffs) were mounted behind the LED panel. A 6V battery pack (4AA&amp;#039;s) was mounted at the opposite end of the platform with Velcro. This non-permanent positioning of the battery pack was chosen so that the batteries could be easily replaced and such that the batteries could act as an adjustable counterbalance for the entire platform.&lt;br /&gt;
&lt;br /&gt;
=== Parts List ===&lt;br /&gt;
* (1) [[Actuators Available in the Mechatronics Lab#6W Maxon motor with 6:1 gearhead and 100 line encoder|6W Maxon Motor]]&lt;br /&gt;
* (1) Toggle Switch&lt;br /&gt;
* (1) 25Ohm Potentiometer&lt;br /&gt;
* (1) Radial ball bearing&lt;br /&gt;
* Expanded PVC sheet&lt;br /&gt;
* Wood (approx. 6&amp;quot; x 5&amp;quot; x 0.5&amp;quot;)&lt;br /&gt;
* Sheet metal screws&lt;br /&gt;
* Various nuts and bolts&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Electrical Design ==&lt;br /&gt;
=== Display Platform Electronics ===&lt;br /&gt;
[[Image:POVschematicsmall.jpg|400px|right|Display circuit]]&lt;br /&gt;
The rotating display platform has 14 LEDs which were controlled through Ports C and D of a PIC. Because bright LEDs were used, the amount of current need could not be supplied directly from the output ports of the PIC. As such, the LEDs were wired through two Darlington arrays (DS2003). These ICs consist of 7 [[Diodes and Transistors#Darlington Pair|Darlington pairs]] with a common emitter. The outputs of the PIC were connected to the bases of the transistors; when the PIC drives one of the bases high, current can flow through the transistor and the corresponding LED lights up. We did not find it necessary to use any resistors in this design.&lt;br /&gt;
&lt;br /&gt;
The display uses a [[Hall Effect Sensor|Hall switch]] to synchronize its display with its rotation, as described above. The implemented circuit, as shown schematically at the right, causes pin B0 of the PIC to go low whenever the hall switch is near the magnet mounted on the base box; when the PIC detects this falling edge on pin B0 it knows its relative position. By timing the interval between two of these events the PIC calculates how fast the display is rotating and adjusts its timing accordingly.&lt;br /&gt;
&lt;br /&gt;
The display receives commands via an [[XBee radio communication between PICs|XBee]] radio module.&lt;br /&gt;
&lt;br /&gt;
=== Control Panel Circuit ===&lt;br /&gt;
[[Image:AP_KS_GM=Control_panel_schematic.jpg|400px|right|Control panel circuit]]&lt;br /&gt;
&lt;br /&gt;
The control panel receives user input through three potentiometers and a pushbutton. The states of these controls are read by the PIC which uses its XBee radio module to send appropriate commands to the display.&lt;br /&gt;
&lt;br /&gt;
If the USB cable is plugged in, the control panel is also responsible for accepting commands from the PC and relaying these commands to the POV through the XBee.&lt;br /&gt;
&lt;br /&gt;
=== Parts list ===&lt;br /&gt;
* (2) PIC18F4520 microcontrollers&lt;br /&gt;
* (1) XBee Radio pair and their [[XBee Interface Board|interface boards]]&lt;br /&gt;
* (2) Darlington Pair Arrays (DS2003)&lt;br /&gt;
* (1) Hall switch&lt;br /&gt;
* (14) Bright white LEDs&lt;br /&gt;
* (3) 1000Ohm potentiometers&lt;br /&gt;
* (1) 25Ohm Potentiometer&lt;br /&gt;
* Push-button&lt;br /&gt;
* Solder Board&lt;br /&gt;
* Stranded wire&lt;br /&gt;
* 10-wire stranded ribbon cable&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Code ==&lt;br /&gt;
&lt;br /&gt;
[[AP_KS_GM-control_panel_code.c|Code for the control panel PIC]]&lt;br /&gt;
&lt;br /&gt;
[[AP_KS_GM-pov_code.c|Code for the display PIC]]&lt;br /&gt;
&lt;br /&gt;
[[AP_KS_GM-POVInput.java|Code for the PC applet]]&lt;br /&gt;
&lt;br /&gt;
== Results ==&lt;br /&gt;
=== Mode 1: Canned Response ===&lt;br /&gt;
In the first mode of operation, a user can just plug in the POV display into a wall socket, turn on the device and display an image immediately. This will allow a quick and easy demonstration without a computer. We have stored ten different responses on the PIC ROM sitting on the rotating display panel. Using a potentiometer, the device allow the user to set which canned response is being displayed.&lt;br /&gt;
&lt;br /&gt;
http://www.youtube.com/watch?v=zx5eXrf9oQI[http://www.youtube.com/watch?v=zx5eXrf9oQI]&lt;br /&gt;
&lt;br /&gt;
=== Mode 2: Real time image input ===&lt;br /&gt;
In the second mode of operation, a user can interact more closely with the POV display. In this mode, the POV  display is connected via a USB port to a computer which needs to have Java installed. The Java program with the code listed above allows a user to draw pictures or type letters which will be tranmitted real time from the control panel PIC to the rotating display panel PIC through the wireless Xbee chips.&lt;br /&gt;
&lt;br /&gt;
In both modes of operation, we have set up knobs that will allow a user to scroll a message manually or set the scroll speed of an image. &lt;br /&gt;
&lt;br /&gt;
http://www.youtube.com/watch?v=urz729AbkG4[http://www.youtube.com/watch?v=urz729AbkG4]&lt;br /&gt;
&lt;br /&gt;
== Additional Notes ==&lt;br /&gt;
=== Possible Future Improvements/Enhancements ===&lt;br /&gt;
We have thought about using RGB LEDS to give the display panel more colorful. Also, we can use different sensors to make the display more interactive. For example putting on distance sensors on the display so that the panel color scheme changes when you wave a hand in front of it.&lt;/div&gt;</summary>
		<author><name>Kwang Sim</name></author>
	</entry>
	<entry>
		<id>https://hades.mech.northwestern.edu//index.php?title=File:Picture_of_Display_Platform&amp;diff=12175</id>
		<title>File:Picture of Display Platform</title>
		<link rel="alternate" type="text/html" href="https://hades.mech.northwestern.edu//index.php?title=File:Picture_of_Display_Platform&amp;diff=12175"/>
		<updated>2009-03-19T22:42:03Z</updated>

		<summary type="html">&lt;p&gt;Kwang Sim: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Kwang Sim</name></author>
	</entry>
	<entry>
		<id>https://hades.mech.northwestern.edu//index.php?title=File:Picture_of_Control_Panel&amp;diff=12173</id>
		<title>File:Picture of Control Panel</title>
		<link rel="alternate" type="text/html" href="https://hades.mech.northwestern.edu//index.php?title=File:Picture_of_Control_Panel&amp;diff=12173"/>
		<updated>2009-03-19T22:40:29Z</updated>

		<summary type="html">&lt;p&gt;Kwang Sim: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Kwang Sim</name></author>
	</entry>
	<entry>
		<id>https://hades.mech.northwestern.edu//index.php?title=Persistence-of-Vision_Display&amp;diff=12171</id>
		<title>Persistence-of-Vision Display</title>
		<link rel="alternate" type="text/html" href="https://hades.mech.northwestern.edu//index.php?title=Persistence-of-Vision_Display&amp;diff=12171"/>
		<updated>2009-03-19T22:39:29Z</updated>

		<summary type="html">&lt;p&gt;Kwang Sim: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Overview ==&lt;br /&gt;
[[image:POV|right]]&lt;br /&gt;
A fully customizable display using the concept of Persistence of Vision was created as a final project for ME333 in 2009. User-specified images (and even moving images) were displayed by rotating a column of LEDs at speeds faster than 300rpm. Each individual LED was modeled as a row of pixels. Conversely, the rotational position of the panel of LEDs represented the pixel columns of the display; the time interval and rotational speed determined the width of the pixel columns.&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
* Gregory McGlynn (Computer Science, Class of 2011) [left]&lt;br /&gt;
* Kwang Xiong Sim (Mechanical Engineering, Class of 2010) [center]&lt;br /&gt;
* Alexander Park (Material Science and Engineering, Class of 2009) [right]&lt;br /&gt;
&lt;br /&gt;
=== Theory of Persistence of Vision ===&lt;br /&gt;
Although arguably much more complex, human vision functions in a manner similar to modern motion pictures; our eyes retain images for a fraction of a second, not unlike a frame in a movie. This is called persistence of vision (POV). When images change fast enough, what we see is a subtle blend of what we see now and a fraction of a second ago.&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
[[image:POVschematic|thumb|right|250px|Schematic of POV Display]]&lt;br /&gt;
In order to avoid the complication of wiring a spinning object, all of the major components of the POV display were placed on a platform mounted on the output shaft of a [[Actuators Available in the Mechatronics Lab#6W Maxon motor with 6:1 gearhead and 100 line encoder|6W Maxon motor]]. The components of this rotating platform include a [[PIC Microcontroller]], a panel of 14 bright white LEDs, a [[Hall Effect Sensor|Hall switch]], an [[XBee radio communication between PICs|XBee radio]], and a battery pack to power the assembly. The strip of LEDs was mounted vertically (or parallel to the axis of rotation) at one end of the platform. To minimize wobbling of the assembly while spinning, the components were positioned such that the center of gravity of the panel passed through the axis of rotation.&lt;br /&gt;
&lt;br /&gt;
Wireless communication between two PICs via [[XBee radio communication between PICs|XBees]] was used to enable live updating of the display based on user input: one PIC (the &amp;quot;display&amp;quot; PIC) was used to control the POV display and receive wireless information from a second PIC. This second &amp;quot;controller&amp;quot; PIC was used to receive user input and transmit it to the display PIC.&lt;br /&gt;
&lt;br /&gt;
=== Modes of Operation ===&lt;br /&gt;
The POV display has two modes of operation, corresponding to two different input methods. &lt;br /&gt;
&lt;br /&gt;
In the first mode of operation, the controller PIC transmits previously stored data to the PIC on the rotor panel. By varying the resistance of a [[Potentiometers|potentiometer]] on the control panel, the user can choose between eleven &amp;quot;canned&amp;quot; messages.&lt;br /&gt;
&lt;br /&gt;
In the second mode of operation, the controller PIC is connected to a computer via [[PIC RS232#FTDIChip TTL-232R USB to RS232 Cable|USB]]. Using a Java program written by Gregory McGlynn, the user can draw pictures or type letters in real time on the computer screen and on the POV display. &lt;br /&gt;
&lt;br /&gt;
=== Position Sensing ===&lt;br /&gt;
To allow for accurate portrayal of the desired image, a [[Hall Effect Sensor|Hall switch]] was utilized to implement position sensing. The Hall switch was mounted near the end of the rotor display platform and a magnet was attached on the top of the base box. The magnet was positioned directly under the path of the hall sensor such that each rotation of the platform triggered an electrical pulse. The display PIC was programmed to reset the image cycle each time a pulse was sensed from the Hall sensor. This allowed reproduction of a stationary image.&lt;br /&gt;
&lt;br /&gt;
Using this implementation of the Hall switch, the display POV was programmed to calculate the rotational velocity of the POV after each rotation by timing the interval between pulses from the Hall switch. This allows for correction of pixel column spacing, such that the column width is consistent even at different speeds. As such, the display may function properly without any information from the motor about its speed.&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Mechanical Design ==&lt;br /&gt;
[[image:POV_CADdrawing|right|thumb|250px|CAD representation of POV Display]]&lt;br /&gt;
=== Base ===&lt;br /&gt;
The base box was fabricated using black expanded PVC. There are three rectangular faces (the back, top, and bottom), two trapezoidal sides and a door that is hinged at the base such that it opens outwards. The control panel was mounted on the inner face of the door.&lt;br /&gt;
&lt;br /&gt;
A wooden base was mounted to the bottom of this PVC box both to increase the box&amp;#039;s integrity and to add to stability of the system with additional mass. A slot was cut near the back of the wooden panel to hold motor in place. &lt;br /&gt;
&lt;br /&gt;
The motor output shaft was connected to the POV display platform through an aluminum coupler. This coupler extended out the top of the box through a [[Bearings|radial ball bearing]], which served to reduce lateral motion of the display platform and to support some of the weight of the platform. The end of the coupler was machined to fit snugly  in to a slot-shaped hole in the display platform. &lt;br /&gt;
&lt;br /&gt;
=== Control Panel ===&lt;br /&gt;
[[image:Picture of Control Panel|right|thumb|250px|Picture of Control Panel]]&lt;br /&gt;
Several knobs, buttons, and switches were placed on a control panel to allow for user input: 1) Motor power switch, 2) Motor speed knob, 3) Selection knob for stored responses, 4) Selection button for stored response, 5) Message position knob, and 6) Scroll speed knob. These components were mounted on a piece of expanded PVC through appropriately sized holes. Specifics on the implementation of these components are described below in the Electronic Design section.&lt;br /&gt;
&lt;br /&gt;
=== Display Platform ===&lt;br /&gt;
[[image:Picture of Display Platform|right|thumb|250px|Picture of Display Platform]]&lt;br /&gt;
Because the display platform rotates rapidly during operation, all of the components were mounted rigidly onto two sheets of expanded PVC. These two sheets were screwed together at the center of the platform, such that a double layer of material was created at the slot for the motor coupler. At one end of the platform, the panel of 14 vertically mounted LEDs was mounted. The electronics of the platform (consisting of a solder board and a PIC board separated by standoffs) were mounted behind the LED panel. A 6V battery pack (4AA&amp;#039;s) was mounted at the opposite end of the platform with Velcro. This non-permanent positioning of the battery pack was chosen so that the batteries could be easily replaced and such that the batteries could act as an adjustable counterbalance for the entire platform.&lt;br /&gt;
&lt;br /&gt;
=== Parts List ===&lt;br /&gt;
* (1) [[Actuators Available in the Mechatronics Lab#6W Maxon motor with 6:1 gearhead and 100 line encoder|6W Maxon Motor]]&lt;br /&gt;
* (1) Toggle Switch&lt;br /&gt;
* (1) 25Ohm Potentiometer&lt;br /&gt;
* (1) Radial ball bearing&lt;br /&gt;
* Expanded PVC sheet&lt;br /&gt;
* Wood (approx. 6&amp;quot; x 5&amp;quot; x 0.5&amp;quot;)&lt;br /&gt;
* Sheet metal screws&lt;br /&gt;
* Various nuts and bolts&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Electrical Design ==&lt;br /&gt;
=== Display Platform Electronics ===&lt;br /&gt;
[[Image:POVschematicsmall.jpg|400px|right|Display circuit]]&lt;br /&gt;
The rotating display platform has 14 LEDs which were controlled through Ports C and D of a PIC. Because bright LEDs were used, the amount of current need could not be supplied directly from the output ports of the PIC. As such, the LEDs were wired through two Darlington arrays (DS2003). These ICs consist of 7 [[Diodes and Transistors#Darlington Pair|Darlington pairs]] with a common emitter. The outputs of the PIC were connected to the bases of the transistors; when the PIC drives one of the bases high, current can flow through the transistor and the corresponding LED lights up. We did not find it necessary to use any resistors in this design.&lt;br /&gt;
&lt;br /&gt;
The display uses a [[Hall Effect Sensor|Hall switch]] to synchronize its display with its rotation, as described above. The implemented circuit, as shown schematically at the right, causes pin B0 of the PIC to go low whenever the hall switch is near the magnet mounted on the base box; when the PIC detects this falling edge on pin B0 it knows its relative position. By timing the interval between two of these events the PIC calculates how fast the display is rotating and adjusts its timing accordingly.&lt;br /&gt;
&lt;br /&gt;
The display receives commands via an [[XBee radio communication between PICs|XBee]] radio module.&lt;br /&gt;
&lt;br /&gt;
=== Control Panel Circuit ===&lt;br /&gt;
[[Image:AP_KS_GM=Control_panel_schematic.jpg|400px|right|Control panel circuit]]&lt;br /&gt;
&lt;br /&gt;
The control panel receives user input through three potentiometers and a pushbutton. The states of these controls are read by the PIC which uses its XBee radio module to send appropriate commands to the display.&lt;br /&gt;
&lt;br /&gt;
If the USB cable is plugged in, the control panel is also responsible for accepting commands from the PC and relaying these commands to the POV through the XBee.&lt;br /&gt;
&lt;br /&gt;
=== Parts list ===&lt;br /&gt;
* (2) PIC18F4520 microcontrollers&lt;br /&gt;
* (1) XBee Radio pair and their [[XBee Interface Board|interface boards]]&lt;br /&gt;
* (2) Darlington Pair Arrays (DS2003)&lt;br /&gt;
* (1) Hall switch&lt;br /&gt;
* (14) Bright white LEDs&lt;br /&gt;
* (3) 1000Ohm potentiometers&lt;br /&gt;
* (1) 25Ohm Potentiometer&lt;br /&gt;
* Push-button&lt;br /&gt;
* Solder Board&lt;br /&gt;
* Stranded wire&lt;br /&gt;
* 10-wire stranded ribbon cable&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Code ==&lt;br /&gt;
&lt;br /&gt;
[[AP_KS_GM-control_panel_code.c|Code for the control panel PIC]]&lt;br /&gt;
&lt;br /&gt;
[[AP_KS_GM-pov_code.c|Code for the display PIC]]&lt;br /&gt;
&lt;br /&gt;
[[AP_KS_GM-POVInput.java|Code for the PC applet]]&lt;br /&gt;
&lt;br /&gt;
== Results ==&lt;br /&gt;
=== Mode 1: Canned Response ===&lt;br /&gt;
In the first mode of operation, a user can just plug in the POV display into a wall socket, turn on the device and display an image immediately. This will allow a quick and easy demonstration without a computer. We have stored ten different responses on the PIC ROM sitting on the rotating display panel. Using a potentiometer, the device allow the user to set which canned response is being displayed.&lt;br /&gt;
&lt;br /&gt;
[http://www.youtube.com/watch?v=zx5eXrf9oQI]&lt;br /&gt;
&lt;br /&gt;
=== Mode 2: Real time image input ===&lt;br /&gt;
In the second mode of operation, a user can interact more closely with the POV display. In this mode, the POV  display is connected via a USB port to a computer which needs to have Java installed. The Java program with the code listed above allows a user to draw pictures or type letters which will be tranmitted real time from the control panel PIC to the rotating display panel PIC through the wireless Xbee chips.&lt;br /&gt;
&lt;br /&gt;
In both modes of operation, we have set up knobs that will allow a user to scroll a message manually or set the scroll speed of an image. &lt;br /&gt;
&lt;br /&gt;
[http://www.youtube.com/watch?v=urz729AbkG4]&lt;br /&gt;
&lt;br /&gt;
== Additional Notes ==&lt;br /&gt;
=== Possible Future Improvements/Enhancements ===&lt;br /&gt;
We have thought about using RGB LEDS to give the display panel more colorful. Also, we can use different sensors to make the display more interactive. For example putting on distance sensors on the display so that the panel color scheme changes when you wave a hand in front of it.&lt;/div&gt;</summary>
		<author><name>Kwang Sim</name></author>
	</entry>
	<entry>
		<id>https://hades.mech.northwestern.edu//index.php?title=Persistence-of-Vision_Display&amp;diff=12167</id>
		<title>Persistence-of-Vision Display</title>
		<link rel="alternate" type="text/html" href="https://hades.mech.northwestern.edu//index.php?title=Persistence-of-Vision_Display&amp;diff=12167"/>
		<updated>2009-03-19T22:38:09Z</updated>

		<summary type="html">&lt;p&gt;Kwang Sim: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Overview ==&lt;br /&gt;
[[image:POV|right]]&lt;br /&gt;
A fully customizable display using the concept of Persistence of Vision was created as a final project for ME333 in 2009. User-specified images (and even moving images) were displayed by rotating a column of LEDs at speeds faster than 300rpm. Each individual LED was modeled as a row of pixels. Conversely, the rotational position of the panel of LEDs represented the pixel columns of the display; the time interval and rotational speed determined the width of the pixel columns.&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
* Gregory McGlynn (Computer Science, Class of 2011) [left]&lt;br /&gt;
* Kwang Xiong Sim (Mechanical Engineering, Class of 2010) [center]&lt;br /&gt;
* Alexander Park (Material Science and Engineering, Class of 2009) [right]&lt;br /&gt;
&lt;br /&gt;
=== Theory of Persistence of Vision ===&lt;br /&gt;
Although arguably much more complex, human vision functions in a manner similar to modern motion pictures; our eyes retain images for a fraction of a second, not unlike a frame in a movie. This is called persistence of vision (POV). When images change fast enough, what we see is a subtle blend of what we see now and a fraction of a second ago.&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
[[image:POVschematic|thumb|right|250px|Schematic of POV Display]]&lt;br /&gt;
In order to avoid the complication of wiring a spinning object, all of the major components of the POV display were placed on a platform mounted on the output shaft of a [[Actuators Available in the Mechatronics Lab#6W Maxon motor with 6:1 gearhead and 100 line encoder|6W Maxon motor]]. The components of this rotating platform include a [[PIC Microcontroller]], a panel of 14 bright white LEDs, a [[Hall Effect Sensor|Hall switch]], an [[XBee radio communication between PICs|XBee radio]], and a battery pack to power the assembly. The strip of LEDs was mounted vertically (or parallel to the axis of rotation) at one end of the platform. To minimize wobbling of the assembly while spinning, the components were positioned such that the center of gravity of the panel passed through the axis of rotation.&lt;br /&gt;
&lt;br /&gt;
Wireless communication between two PICs via [[XBee radio communication between PICs|XBees]] was used to enable live updating of the display based on user input: one PIC (the &amp;quot;display&amp;quot; PIC) was used to control the POV display and receive wireless information from a second PIC. This second &amp;quot;controller&amp;quot; PIC was used to receive user input and transmit it to the display PIC.&lt;br /&gt;
&lt;br /&gt;
=== Modes of Operation ===&lt;br /&gt;
The POV display has two modes of operation, corresponding to two different input methods. &lt;br /&gt;
&lt;br /&gt;
In the first mode of operation, the controller PIC transmits previously stored data to the PIC on the rotor panel. By varying the resistance of a [[Potentiometers|potentiometer]] on the control panel, the user can choose between eleven &amp;quot;canned&amp;quot; messages.&lt;br /&gt;
&lt;br /&gt;
In the second mode of operation, the controller PIC is connected to a computer via [[PIC RS232#FTDIChip TTL-232R USB to RS232 Cable|USB]]. Using a Java program written by Gregory McGlynn, the user can draw pictures or type letters in real time on the computer screen and on the POV display. &lt;br /&gt;
&lt;br /&gt;
=== Position Sensing ===&lt;br /&gt;
To allow for accurate portrayal of the desired image, a [[Hall Effect Sensor|Hall switch]] was utilized to implement position sensing. The Hall switch was mounted near the end of the rotor display platform and a magnet was attached on the top of the base box. The magnet was positioned directly under the path of the hall sensor such that each rotation of the platform triggered an electrical pulse. The display PIC was programmed to reset the image cycle each time a pulse was sensed from the Hall sensor. This allowed reproduction of a stationary image.&lt;br /&gt;
&lt;br /&gt;
Using this implementation of the Hall switch, the display POV was programmed to calculate the rotational velocity of the POV after each rotation by timing the interval between pulses from the Hall switch. This allows for correction of pixel column spacing, such that the column width is consistent even at different speeds. As such, the display may function properly without any information from the motor about its speed.&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Mechanical Design ==&lt;br /&gt;
[[image:POV_CADdrawing|right|thumb|250px|CAD representation of POV Display]]&lt;br /&gt;
=== Base ===&lt;br /&gt;
The base box was fabricated using black expanded PVC. There are three rectangular faces (the back, top, and bottom), two trapezoidal sides and a door that is hinged at the base such that it opens outwards. The control panel was mounted on the inner face of the door.&lt;br /&gt;
&lt;br /&gt;
A wooden base was mounted to the bottom of this PVC box both to increase the box&amp;#039;s integrity and to add to stability of the system with additional mass. A slot was cut near the back of the wooden panel to hold motor in place. &lt;br /&gt;
&lt;br /&gt;
The motor output shaft was connected to the POV display platform through an aluminum coupler. This coupler extended out the top of the box through a [[Bearings|radial ball bearing]], which served to reduce lateral motion of the display platform and to support some of the weight of the platform. The end of the coupler was machined to fit snugly  in to a slot-shaped hole in the display platform. &lt;br /&gt;
&lt;br /&gt;
=== Control Panel ===&lt;br /&gt;
[[image:Picture of Control Panel|right|thumb|250px|CAD representation of POV Display]]&lt;br /&gt;
Several knobs, buttons, and switches were placed on a control panel to allow for user input: 1) Motor power switch, 2) Motor speed knob, 3) Selection knob for stored responses, 4) Selection button for stored response, 5) Message position knob, and 6) Scroll speed knob. These components were mounted on a piece of expanded PVC through appropriately sized holes. Specifics on the implementation of these components are described below in the Electronic Design section.&lt;br /&gt;
&lt;br /&gt;
=== Display Platform ===&lt;br /&gt;
[[image:POV_Picture of Display Platform|right|thumb|250px|CAD representation of POV Display]]&lt;br /&gt;
Because the display platform rotates rapidly during operation, all of the components were mounted rigidly onto two sheets of expanded PVC. These two sheets were screwed together at the center of the platform, such that a double layer of material was created at the slot for the motor coupler. At one end of the platform, the panel of 14 vertically mounted LEDs was mounted. The electronics of the platform (consisting of a solder board and a PIC board separated by standoffs) were mounted behind the LED panel. A 6V battery pack (4AA&amp;#039;s) was mounted at the opposite end of the platform with Velcro. This non-permanent positioning of the battery pack was chosen so that the batteries could be easily replaced and such that the batteries could act as an adjustable counterbalance for the entire platform.&lt;br /&gt;
&lt;br /&gt;
=== Parts List ===&lt;br /&gt;
* (1) [[Actuators Available in the Mechatronics Lab#6W Maxon motor with 6:1 gearhead and 100 line encoder|6W Maxon Motor]]&lt;br /&gt;
* (1) Toggle Switch&lt;br /&gt;
* (1) 25Ohm Potentiometer&lt;br /&gt;
* (1) Radial ball bearing&lt;br /&gt;
* Expanded PVC sheet&lt;br /&gt;
* Wood (approx. 6&amp;quot; x 5&amp;quot; x 0.5&amp;quot;)&lt;br /&gt;
* Sheet metal screws&lt;br /&gt;
* Various nuts and bolts&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Electrical Design ==&lt;br /&gt;
=== Display Platform Electronics ===&lt;br /&gt;
[[Image:POVschematicsmall.jpg|400px|right|Display circuit]]&lt;br /&gt;
The rotating display platform has 14 LEDs which were controlled through Ports C and D of a PIC. Because bright LEDs were used, the amount of current need could not be supplied directly from the output ports of the PIC. As such, the LEDs were wired through two Darlington arrays (DS2003). These ICs consist of 7 [[Diodes and Transistors#Darlington Pair|Darlington pairs]] with a common emitter. The outputs of the PIC were connected to the bases of the transistors; when the PIC drives one of the bases high, current can flow through the transistor and the corresponding LED lights up. We did not find it necessary to use any resistors in this design.&lt;br /&gt;
&lt;br /&gt;
The display uses a [[Hall Effect Sensor|Hall switch]] to synchronize its display with its rotation, as described above. The implemented circuit, as shown schematically at the right, causes pin B0 of the PIC to go low whenever the hall switch is near the magnet mounted on the base box; when the PIC detects this falling edge on pin B0 it knows its relative position. By timing the interval between two of these events the PIC calculates how fast the display is rotating and adjusts its timing accordingly.&lt;br /&gt;
&lt;br /&gt;
The display receives commands via an [[XBee radio communication between PICs|XBee]] radio module.&lt;br /&gt;
&lt;br /&gt;
=== Control Panel Circuit ===&lt;br /&gt;
[[Image:AP_KS_GM=Control_panel_schematic.jpg|400px|right|Control panel circuit]]&lt;br /&gt;
&lt;br /&gt;
The control panel receives user input through three potentiometers and a pushbutton. The states of these controls are read by the PIC which uses its XBee radio module to send appropriate commands to the display.&lt;br /&gt;
&lt;br /&gt;
If the USB cable is plugged in, the control panel is also responsible for accepting commands from the PC and relaying these commands to the POV through the XBee.&lt;br /&gt;
&lt;br /&gt;
=== Parts list ===&lt;br /&gt;
* (2) PIC18F4520 microcontrollers&lt;br /&gt;
* (1) XBee Radio pair and their [[XBee Interface Board|interface boards]]&lt;br /&gt;
* (2) Darlington Pair Arrays (DS2003)&lt;br /&gt;
* (1) Hall switch&lt;br /&gt;
* (14) Bright white LEDs&lt;br /&gt;
* (3) 1000Ohm potentiometers&lt;br /&gt;
* (1) 25Ohm Potentiometer&lt;br /&gt;
* Push-button&lt;br /&gt;
* Solder Board&lt;br /&gt;
* Stranded wire&lt;br /&gt;
* 10-wire stranded ribbon cable&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Code ==&lt;br /&gt;
&lt;br /&gt;
[[AP_KS_GM-control_panel_code.c|Code for the control panel PIC]]&lt;br /&gt;
&lt;br /&gt;
[[AP_KS_GM-pov_code.c|Code for the display PIC]]&lt;br /&gt;
&lt;br /&gt;
[[AP_KS_GM-POVInput.java|Code for the PC applet]]&lt;br /&gt;
&lt;br /&gt;
== Results ==&lt;br /&gt;
=== Mode 1: Canned Response ===&lt;br /&gt;
In the first mode of operation, a user can just plug in the POV display into a wall socket, turn on the device and display an image immediately. This will allow a quick and easy demonstration without a computer. We have stored ten different responses on the PIC ROM sitting on the rotating display panel. Using a potentiometer, the device allow the user to set which canned response is being displayed.&lt;br /&gt;
&lt;br /&gt;
[http://www.youtube.com/watch?v=zx5eXrf9oQI]&lt;br /&gt;
&lt;br /&gt;
=== Mode 2: Real time image input ===&lt;br /&gt;
In the second mode of operation, a user can interact more closely with the POV display. In this mode, the POV  display is connected via a USB port to a computer which needs to have Java installed. The Java program with the code listed above allows a user to draw pictures or type letters which will be tranmitted real time from the control panel PIC to the rotating display panel PIC through the wireless Xbee chips.&lt;br /&gt;
&lt;br /&gt;
In both modes of operation, we have set up knobs that will allow a user to scroll a message manually or set the scroll speed of an image. &lt;br /&gt;
&lt;br /&gt;
[http://www.youtube.com/watch?v=urz729AbkG4]&lt;br /&gt;
&lt;br /&gt;
== Additional Notes ==&lt;br /&gt;
=== Possible Future Improvements/Enhancements ===&lt;br /&gt;
We have thought about using RGB LEDS to give the display panel more colorful. Also, we can use different sensors to make the display more interactive. For example putting on distance sensors on the display so that the panel color scheme changes when you wave a hand in front of it.&lt;/div&gt;</summary>
		<author><name>Kwang Sim</name></author>
	</entry>
	<entry>
		<id>https://hades.mech.northwestern.edu//index.php?title=Persistence-of-Vision_Display&amp;diff=12164</id>
		<title>Persistence-of-Vision Display</title>
		<link rel="alternate" type="text/html" href="https://hades.mech.northwestern.edu//index.php?title=Persistence-of-Vision_Display&amp;diff=12164"/>
		<updated>2009-03-19T22:34:56Z</updated>

		<summary type="html">&lt;p&gt;Kwang Sim: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Overview ==&lt;br /&gt;
[[image:POV|right]]&lt;br /&gt;
A fully customizable display using the concept of Persistence of Vision was created as a final project for ME333 in 2009. User-specified images (and even moving images) were displayed by rotating a column of LEDs at speeds faster than 300rpm. Each individual LED was modeled as a row of pixels. Conversely, the rotational position of the panel of LEDs represented the pixel columns of the display; the time interval and rotational speed determined the width of the pixel columns.&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
* Gregory McGlynn (Computer Science, Class of 2011) [left]&lt;br /&gt;
* Kwang Xiong Sim (Mechanical Engineering, Class of 2010) [center]&lt;br /&gt;
* Alexander Park (Material Science and Engineering, Class of 2009) [right]&lt;br /&gt;
&lt;br /&gt;
=== Theory of Persistence of Vision ===&lt;br /&gt;
Although arguably much more complex, human vision functions in a manner similar to modern motion pictures; our eyes retain images for a fraction of a second, not unlike a frame in a movie. This is called persistence of vision (POV). When images change fast enough, what we see is a subtle blend of what we see now and a fraction of a second ago.&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
[[image:POVschematic|thumb|right|250px|Schematic of POV Display]]&lt;br /&gt;
In order to avoid the complication of wiring a spinning object, all of the major components of the POV display were placed on a platform mounted on the output shaft of a [[Actuators Available in the Mechatronics Lab#6W Maxon motor with 6:1 gearhead and 100 line encoder|6W Maxon motor]]. The components of this rotating platform include a [[PIC Microcontroller]], a panel of 14 bright white LEDs, a [[Hall Effect Sensor|Hall switch]], an [[XBee radio communication between PICs|XBee radio]], and a battery pack to power the assembly. The strip of LEDs was mounted vertically (or parallel to the axis of rotation) at one end of the platform. To minimize wobbling of the assembly while spinning, the components were positioned such that the center of gravity of the panel passed through the axis of rotation.&lt;br /&gt;
&lt;br /&gt;
Wireless communication between two PICs via [[XBee radio communication between PICs|XBees]] was used to enable live updating of the display based on user input: one PIC (the &amp;quot;display&amp;quot; PIC) was used to control the POV display and receive wireless information from a second PIC. This second &amp;quot;controller&amp;quot; PIC was used to receive user input and transmit it to the display PIC.&lt;br /&gt;
&lt;br /&gt;
=== Modes of Operation ===&lt;br /&gt;
The POV display has two modes of operation, corresponding to two different input methods. &lt;br /&gt;
&lt;br /&gt;
In the first mode of operation, the controller PIC transmits previously stored data to the PIC on the rotor panel. By varying the resistance of a [[Potentiometers|potentiometer]] on the control panel, the user can choose between eleven &amp;quot;canned&amp;quot; messages.&lt;br /&gt;
&lt;br /&gt;
In the second mode of operation, the controller PIC is connected to a computer via [[PIC RS232#FTDIChip TTL-232R USB to RS232 Cable|USB]]. Using a Java program written by Gregory McGlynn, the user can draw pictures or type letters in real time on the computer screen and on the POV display. &lt;br /&gt;
&lt;br /&gt;
=== Position Sensing ===&lt;br /&gt;
To allow for accurate portrayal of the desired image, a [[Hall Effect Sensor|Hall switch]] was utilized to implement position sensing. The Hall switch was mounted near the end of the rotor display platform and a magnet was attached on the top of the base box. The magnet was positioned directly under the path of the hall sensor such that each rotation of the platform triggered an electrical pulse. The display PIC was programmed to reset the image cycle each time a pulse was sensed from the Hall sensor. This allowed reproduction of a stationary image.&lt;br /&gt;
&lt;br /&gt;
Using this implementation of the Hall switch, the display POV was programmed to calculate the rotational velocity of the POV after each rotation by timing the interval between pulses from the Hall switch. This allows for correction of pixel column spacing, such that the column width is consistent even at different speeds. As such, the display may function properly without any information from the motor about its speed.&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Mechanical Design ==&lt;br /&gt;
[[image:POV_CADdrawing|right|thumb|250px|CAD representation of POV Display]]&lt;br /&gt;
=== Base ===&lt;br /&gt;
[[image:POV Base|right]]&lt;br /&gt;
The base box was fabricated using black expanded PVC. There are three rectangular faces (the back, top, and bottom), two trapezoidal sides and a door that is hinged at the base such that it opens outwards. The control panel was mounted on the inner face of the door.&lt;br /&gt;
&lt;br /&gt;
A wooden base was mounted to the bottom of this PVC box both to increase the box&amp;#039;s integrity and to add to stability of the system with additional mass. A slot was cut near the back of the wooden panel to hold motor in place. &lt;br /&gt;
&lt;br /&gt;
The motor output shaft was connected to the POV display platform through an aluminum coupler. This coupler extended out the top of the box through a [[Bearings|radial ball bearing]], which served to reduce lateral motion of the display platform and to support some of the weight of the platform. The end of the coupler was machined to fit snugly  in to a slot-shaped hole in the display platform. &lt;br /&gt;
&lt;br /&gt;
=== Control Panel ===&lt;br /&gt;
[[image:POVcontrolpanel|right]]&lt;br /&gt;
Several knobs, buttons, and switches were placed on a control panel to allow for user input: 1) Motor power switch, 2) Motor speed knob, 3) Selection knob for stored responses, 4) Selection button for stored response, 5) Message position knob, and 6) Scroll speed knob. These components were mounted on a piece of expanded PVC through appropriately sized holes. Specifics on the implementation of these components are described below in the Electronic Design section.&lt;br /&gt;
&lt;br /&gt;
=== Display Platform ===&lt;br /&gt;
[[image:POVdisplay platform|right]]&lt;br /&gt;
Because the display platform rotates rapidly during operation, all of the components were mounted rigidly onto two sheets of expanded PVC. These two sheets were screwed together at the center of the platform, such that a double layer of material was created at the slot for the motor coupler. At one end of the platform, the panel of 14 vertically mounted LEDs was mounted. The electronics of the platform (consisting of a solder board and a PIC board separated by standoffs) were mounted behind the LED panel. A 6V battery pack (4AA&amp;#039;s) was mounted at the opposite end of the platform with Velcro. This non-permanent positioning of the battery pack was chosen so that the batteries could be easily replaced and such that the batteries could act as an adjustable counterbalance for the entire platform.&lt;br /&gt;
&lt;br /&gt;
=== Parts List ===&lt;br /&gt;
* (1) [[Actuators Available in the Mechatronics Lab#6W Maxon motor with 6:1 gearhead and 100 line encoder|6W Maxon Motor]]&lt;br /&gt;
* (1) Toggle Switch&lt;br /&gt;
* (1) 25Ohm Potentiometer&lt;br /&gt;
* (1) Radial ball bearing&lt;br /&gt;
* Expanded PVC sheet&lt;br /&gt;
* Wood (approx. 6&amp;quot; x 5&amp;quot; x 0.5&amp;quot;)&lt;br /&gt;
* Sheet metal screws&lt;br /&gt;
* Various nuts and bolts&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Electrical Design ==&lt;br /&gt;
=== Display Platform Electronics ===&lt;br /&gt;
[[Image:POVschematicsmall.jpg|400px|right|Display circuit]]&lt;br /&gt;
The rotating display platform has 14 LEDs which were controlled through Ports C and D of a PIC. Because bright LEDs were used, the amount of current need could not be supplied directly from the output ports of the PIC. As such, the LEDs were wired through two Darlington arrays (DS2003). These ICs consist of 7 [[Diodes and Transistors#Darlington Pair|Darlington pairs]] with a common emitter. The outputs of the PIC were connected to the bases of the transistors; when the PIC drives one of the bases high, current can flow through the transistor and the corresponding LED lights up. We did not find it necessary to use any resistors in this design.&lt;br /&gt;
&lt;br /&gt;
The display uses a [[Hall Effect Sensor|Hall switch]] to synchronize its display with its rotation, as described above. The implemented circuit, as shown schematically at the right, causes pin B0 of the PIC to go low whenever the hall switch is near the magnet mounted on the base box; when the PIC detects this falling edge on pin B0 it knows its relative position. By timing the interval between two of these events the PIC calculates how fast the display is rotating and adjusts its timing accordingly.&lt;br /&gt;
&lt;br /&gt;
The display receives commands via an [[XBee radio communication between PICs|XBee]] radio module.&lt;br /&gt;
&lt;br /&gt;
=== Control Panel Circuit ===&lt;br /&gt;
[[Image:AP_KS_GM=Control_panel_schematic.jpg|400px|right|Control panel circuit]]&lt;br /&gt;
&lt;br /&gt;
The control panel receives user input through three potentiometers and a pushbutton. The states of these controls are read by the PIC which uses its XBee radio module to send appropriate commands to the display.&lt;br /&gt;
&lt;br /&gt;
If the USB cable is plugged in, the control panel is also responsible for accepting commands from the PC and relaying these commands to the POV through the XBee.&lt;br /&gt;
&lt;br /&gt;
=== Parts list ===&lt;br /&gt;
* (2) PIC18F4520 microcontrollers&lt;br /&gt;
* (1) XBee Radio pair and their [[XBee Interface Board|interface boards]]&lt;br /&gt;
* (2) Darlington Pair Arrays (DS2003)&lt;br /&gt;
* (1) Hall switch&lt;br /&gt;
* (14) Bright white LEDs&lt;br /&gt;
* (3) 1000Ohm potentiometers&lt;br /&gt;
* (1) 25Ohm Potentiometer&lt;br /&gt;
* Push-button&lt;br /&gt;
* Solder Board&lt;br /&gt;
* Stranded wire&lt;br /&gt;
* 10-wire stranded ribbon cable&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Code ==&lt;br /&gt;
&lt;br /&gt;
[[AP_KS_GM-control_panel_code.c|Code for the control panel PIC]]&lt;br /&gt;
&lt;br /&gt;
[[AP_KS_GM-pov_code.c|Code for the display PIC]]&lt;br /&gt;
&lt;br /&gt;
[[AP_KS_GM-POVInput.java|Code for the PC applet]]&lt;br /&gt;
&lt;br /&gt;
== Results ==&lt;br /&gt;
=== Mode 1: Canned Response ===&lt;br /&gt;
In the first mode of operation, a user can just plug in the POV display into a wall socket, turn on the device and display an image immediately. This will allow a quick and easy demonstration without a computer. We have stored ten different responses on the PIC ROM sitting on the rotating display panel. Using a potentiometer, the device allow the user to set which canned response is being displayed.&lt;br /&gt;
&lt;br /&gt;
[http://www.youtube.com/watch?v=zx5eXrf9oQI]&lt;br /&gt;
&lt;br /&gt;
=== Mode 2: Real time image input ===&lt;br /&gt;
In the second mode of operation, a user can interact more closely with the POV display. In this mode, the POV  display is connected via a USB port to a computer which needs to have Java installed. The Java program with the code listed above allows a user to draw pictures or type letters which will be tranmitted real time from the control panel PIC to the rotating display panel PIC through the wireless Xbee chips.&lt;br /&gt;
&lt;br /&gt;
In both modes of operation, we have set up knobs that will allow a user to scroll a message manually or set the scroll speed of an image. &lt;br /&gt;
&lt;br /&gt;
[http://www.youtube.com/watch?v=urz729AbkG4]&lt;br /&gt;
&lt;br /&gt;
== Additional Notes ==&lt;br /&gt;
=== Possible Future Improvements/Enhancements ===&lt;br /&gt;
We have thought about using RGB LEDS to give the display panel more colorful. Also, we can use different sensors to make the display more interactive. For example putting on distance sensors on the display so that the panel color scheme changes when you wave a hand in front of it.&lt;/div&gt;</summary>
		<author><name>Kwang Sim</name></author>
	</entry>
	<entry>
		<id>https://hades.mech.northwestern.edu//index.php?title=Persistence-of-Vision_Display&amp;diff=12137</id>
		<title>Persistence-of-Vision Display</title>
		<link rel="alternate" type="text/html" href="https://hades.mech.northwestern.edu//index.php?title=Persistence-of-Vision_Display&amp;diff=12137"/>
		<updated>2009-03-19T22:14:07Z</updated>

		<summary type="html">&lt;p&gt;Kwang Sim: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Overview ==&lt;br /&gt;
[[image:POV|right]]&lt;br /&gt;
A fully customizable display using the concept of Persistence of Vision was created as a final project for ME333 in 2009. User-specified images (and even moving images) were displayed by rotating a column of LEDs at speeds faster than 300rpm. Each individual LED was modeled as a row of pixels. Conversely, the rotational position of the panel of LEDs represented the pixel columns of the display; the time interval and rotational speed determined the width of the pixel columns.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
* Gregory McGlynn (Computer Science, Class of 2011) [left]&lt;br /&gt;
* Kwang Xiong Sim (Mechanical Engineering, Class of 2010) [center]&lt;br /&gt;
* Alexander Park (Material Science and Engineering, Class of 2009) [right]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Theory of Persistence of Vision ===&lt;br /&gt;
Although arguably much more complex, human vision functions in a manner similar to modern motion pictures; our eyes retain images for a fraction of a second, not unlike a frame in a movie. This is called persistence of vision (POV). When images change fast enough, what we see is a subtle blend of what we see now and a fraction of a second ago.&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
[[image:POVschematic|thumb|right|250px|Schematic of POV Display]]&lt;br /&gt;
&lt;br /&gt;
In order to avoid the complication of wiring a spinning object, all of the major components of the POV display were placed on a platform mounted on the output shaft of a [[Actuators Available in the Mechatronics Lab#6W Maxon motor with 6:1 gearhead and 100 line encoder|6W Maxon motor]]. The components of this rotating platform include a [[PIC Microcontroller]], a panel of 14 bright white LEDs, a [[Hall Effect Sensor|Hall switch]], an [[XBee radio communication between PICs|XBee radio]], and a battery pack to power the assembly. The strip of LEDs was mounted vertically (or parallel to the axis of rotation) at one end of the platform. To minimize wobbling of the assembly while spinning, the components were positioned such that the center of gravity of the panel passed through the axis of rotation.&lt;br /&gt;
&lt;br /&gt;
Wireless communication between two PICs via [[XBee radio communication between PICs|XBees]] was used to enable live updating of the display based on user input: one PIC (the &amp;quot;display&amp;quot; PIC) was used to control the POV display and receive wireless information from a second PIC. This second &amp;quot;controller&amp;quot; PIC was used to receive user input and transmit it to the display PIC.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Modes of Operation ===&lt;br /&gt;
&lt;br /&gt;
The POV display has two modes of operation, corresponding to two different input methods. &lt;br /&gt;
&lt;br /&gt;
In the first mode of operation, the controller PIC transmits previously stored data to the PIC on the rotor panel. By varying the resistance of a [[Potentiometers|potentiometer]] on the control panel, the user can choose between eleven &amp;quot;canned&amp;quot; messages.&lt;br /&gt;
&lt;br /&gt;
In the second mode of operation, the controller PIC is connected to a computer via [[PIC RS232#FTDIChip TTL-232R USB to RS232 Cable|USB]]. Using a Java program written by Gregory McGlynn, the user can draw pictures or type letters in real time on the computer screen and on the POV display. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Position Sensing ===&lt;br /&gt;
&lt;br /&gt;
To allow for accurate portrayal of the desired image, a [[Hall Effect Sensor|Hall switch]] was utilized to implement position sensing. The Hall switch was mounted near the end of the rotor display platform and a magnet was attached on the top of the base box. The magnet was positioned directly under the path of the hall sensor such that each rotation of the platform triggered an electrical pulse. The display PIC was programmed to reset the image cycle each time a pulse was sensed from the Hall sensor. This allowed reproduction of a stationary image.&lt;br /&gt;
&lt;br /&gt;
Using this implementation of the Hall switch, the display POV was programmed to calculate the rotational velocity of the POV after each rotation by timing the interval between pulses from the Hall switch. This allows for correction of pixel column spacing, such that the column width is consistent even at different speeds. As such, the display may function properly without any information from the motor about its speed.&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Mechanical Design ==&lt;br /&gt;
[[image:POV_CADdrawing|right|thumb|250px|CAD representation of POV Display]]&lt;br /&gt;
=== Base ===&lt;br /&gt;
The base box was fabricated using black expanded PVC. There are three rectangular faces (the back, top, and bottom), two trapezoidal sides and a door that is hinged at the base such that it opens outwards. The control panel was mounted on the inner face of the door.&lt;br /&gt;
&lt;br /&gt;
A wooden base was mounted to the bottom of this PVC box both to increase the box&amp;#039;s integrity and to add to stability of the system with additional mass. A slot was cut near the back of the wooden panel to hold motor in place. &lt;br /&gt;
&lt;br /&gt;
The motor output shaft was connected to the POV display platform through an aluminum coupler. This coupler extended out the top of the box through a [[Bearings|radial ball bearing]], which served to reduce lateral motion of the display platform and to support some of the weight of the platform. The end of the coupler was machined to fit snugly  in to a slot-shaped hole in the display platform. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Control Panel ===&lt;br /&gt;
Several knobs, buttons, and switches were placed on a control panel to allow for user input: 1) Motor power switch, 2) Motor speed knob, 3) Selection knob for stored responses, 4) Selection button for stored response, 5) Message position knob, and 6) Scroll speed knob. These components were mounted on a piece of expanded PVC through appropriately sized holes. Specifics on the implementation of these components are described below in the Electronic Design section.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Display Platform ===&lt;br /&gt;
Because the display platform rotates rapidly during operation, all of the components were mounted rigidly onto two sheets of expanded PVC. These two sheets were screwed together at the center of the platform, such that a double layer of material was created at the slot for the motor coupler. At one end of the platform, the panel of 14 vertically mounted LEDs was mounted. The electronics of the platform (consisting of a solder board and a PIC board separated by standoffs) were mounted behind the LED panel. A 6V battery pack (4AA&amp;#039;s) was mounted at the opposite end of the platform with Velcro. This non-permanent positioning of the battery pack was chosen so that the batteries could be easily replaced and such that the batteries could act as an adjustable counterbalance for the entire platform.&lt;br /&gt;
&lt;br /&gt;
== Electrical Design ==&lt;br /&gt;
=== Display Platform Electronics ===&lt;br /&gt;
[[Image:POVschematicsmall.jpg|400px|right|Display circuit]]&lt;br /&gt;
The rotating display platform has 14 LEDs which were controlled through Ports C and D of a PIC. Because bright LEDs were used, the amount of current need could not be supplied directly from the output ports of the PIC. As such, the LEDs were wired through two Darlington arrays (DS2003). These ICs consist of 7 [[Diodes and Transistors#Darlington Pair|Darlington pairs]] with a common emitter. The outputs of the PIC were connected to the bases of the transistors; when the PIC drives one of the bases high, current can flow through the transistor and the corresponding LED lights up. We did not find it necessary to use any resistors in this design.&lt;br /&gt;
&lt;br /&gt;
The display uses a [[Hall Effect Sensor|Hall switch]] to synchronize its display with its rotation, as described above. The implemented circuit, as shown schematically at the right, causes pin B0 of the PIC to go low whenever the hall switch is near the magnet mounted on the base box; when the PIC detects this falling edge on pin B0 it knows its relative position. By timing the interval between two of these events the PIC calculates how fast the display is rotating and adjusts its timing accordingly.&lt;br /&gt;
&lt;br /&gt;
The display receives commands via an [[XBee radio communication between PICs|XBee]] radio module.&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot;&amp;gt;&lt;br /&gt;
=== Control Panel Circuit ===&lt;br /&gt;
[[Image:AP_KS_GM=Control_panel_schematic.jpg|400px|right|Control panel circuit]]&lt;br /&gt;
&lt;br /&gt;
The control panel receives user input through three potentiometers and a pushbutton. The states of these controls are read by the PIC which uses its XBee radio module to send appropriate commands to the display.&lt;br /&gt;
&lt;br /&gt;
If the USB cable is plugged in, the control panel is also responsible for accepting commands from the PC and relaying these commands to the POV through the XBee.&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== List of Electronic Components ===&lt;br /&gt;
* 2 PIC18F4520 microcontrollers&lt;br /&gt;
* 2 XBee Radios and their [[XBee Interface Board|interface boards]]&lt;br /&gt;
* 1 Hall switch&lt;br /&gt;
* 14 Bright white LEDs&lt;br /&gt;
* 1 6W Maxon Motor&lt;br /&gt;
* Solder Board&lt;br /&gt;
* 3 1000Ohm potentiometers&lt;br /&gt;
* 1 25Ohm Potentiometer&lt;br /&gt;
* 1 Toggle Switch&lt;br /&gt;
* 1 Push-button&lt;br /&gt;
&lt;br /&gt;
== Code ==&lt;br /&gt;
&lt;br /&gt;
[[AP_KS_GM-control_panel_code.c|Code for the control panel PIC]]&lt;br /&gt;
&lt;br /&gt;
[[AP_KS_GM-pov_code.c|Code for the display PIC]]&lt;br /&gt;
&lt;br /&gt;
[[AP_KS_GM-POVInput.java|Code for the PC applet]]&lt;br /&gt;
&lt;br /&gt;
== Results ==&lt;br /&gt;
=== Mode 1: Canned Response ===&lt;br /&gt;
In the first mode of operation, a user can just plug in the POV display into a wall socket, turn on the device and display an image immediately. This will allow a quick and easy demonstration without a computer. We have stored ten different responses on the PIC ROM sitting on the rotating display panel. Using a potentiometer, the device allow the user to set which canned response is being displayed.&lt;br /&gt;
&lt;br /&gt;
[http://www.youtube.com/watch?v=zx5eXrf9oQI]&lt;br /&gt;
&lt;br /&gt;
=== Mode 2: Real time image input ===&lt;br /&gt;
In the second mode of operation, a user can interact more closely with the POV display. In this mode, the POV  display is connected via a USB port to a computer which needs to have Java installed. The Java program with the code listed above allows a user to draw pictures or type letters which will be tranmitted real time from the control panel PIC to the rotating display panel PIC through the wireless Xbee chips.&lt;br /&gt;
&lt;br /&gt;
In both modes of operation, we have set up knobs that will allow a user to scroll a message manually or set the scroll speed of an image. &lt;br /&gt;
&lt;br /&gt;
[http://www.youtube.com/watch?v=urz729AbkG4]&lt;br /&gt;
&lt;br /&gt;
== Additional Notes ==&lt;br /&gt;
=== Possible Future Improvements/Enhancements ===&lt;br /&gt;
We have thought about using RGB LEDS to give the display panel more colorful. Also, we can use different sensors to make the display more interactive. For example putting on distance sensors on the display so that the panel color scheme changes when you wave a hand in front of it.&lt;/div&gt;</summary>
		<author><name>Kwang Sim</name></author>
	</entry>
	<entry>
		<id>https://hades.mech.northwestern.edu//index.php?title=AP_KS_GM-POVInput.java&amp;diff=11795</id>
		<title>AP KS GM-POVInput.java</title>
		<link rel="alternate" type="text/html" href="https://hades.mech.northwestern.edu//index.php?title=AP_KS_GM-POVInput.java&amp;diff=11795"/>
		<updated>2009-03-19T09:26:34Z</updated>

		<summary type="html">&lt;p&gt;Kwang Sim: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;pre&amp;gt;/**********************************************&lt;br /&gt;
 * POVController.java&lt;br /&gt;
 * Author:Greg McGlynn&lt;br /&gt;
 * Persistence-of-Vision Display project&lt;br /&gt;
 * Alexander Park, Kwang Xiong Sim, Greg McGlynn&lt;br /&gt;
 * ME 333 Mechatronics - Winter 2008&lt;br /&gt;
 * Northwestern University&lt;br /&gt;
 *&lt;br /&gt;
 *    This code uses the SimpleSerial code found at&lt;br /&gt;
 * http://alumni.media.mit.edu/~benres/simpleserial/&lt;br /&gt;
 * It lets you talk serial from a Java program on a Windows PC.&lt;br /&gt;
 * Java programmers may find this useful for a project.&lt;br /&gt;
 *&lt;br /&gt;
 *    This code runs on a PC and talks through a serial port to&lt;br /&gt;
 * the POV. This code is hacked together, ugly, and uncommented!&lt;br /&gt;
 * Read at your own risk!&lt;br /&gt;
 **********************************************/&lt;br /&gt;
&lt;br /&gt;
import java.awt.*;&lt;br /&gt;
import java.awt.image.*;&lt;br /&gt;
import java.awt.event.*;&lt;br /&gt;
import javax.swing.event.*;&lt;br /&gt;
import java.io.*;&lt;br /&gt;
&lt;br /&gt;
public class POVController extends MouseInputAdapter implements ActionListener, KeyListener, WindowListener&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
	public static void main(String[] args)&lt;br /&gt;
	{&lt;br /&gt;
                //initialization necessary to accept keyboard input (very long functions), not shown&lt;br /&gt;
		init();&lt;br /&gt;
		init2();&lt;br /&gt;
		init3();&lt;br /&gt;
		init4();&lt;br /&gt;
&lt;br /&gt;
		new POVController().run();&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	InputStream serIn;&lt;br /&gt;
	OutputStream serOut; //we talk to the display with this&lt;br /&gt;
&lt;br /&gt;
        //the image:&lt;br /&gt;
        boolean[][] leds = new boolean[width][height];&lt;br /&gt;
&lt;br /&gt;
        //user interface stuff:&lt;br /&gt;
	final int px = 6;&lt;br /&gt;
	final int width = 193;&lt;br /&gt;
	final int height = 14;&lt;br /&gt;
&lt;br /&gt;
	final int offX = 10;&lt;br /&gt;
	final int offY = 100;&lt;br /&gt;
&lt;br /&gt;
	Checkbox eraseCheckbox;&lt;br /&gt;
	Button clearButton;&lt;br /&gt;
	Button refreshButton;&lt;br /&gt;
	Button dumpButton;&lt;br /&gt;
	Button invertButton;&lt;br /&gt;
&lt;br /&gt;
	static int[][][] ascii = new int[255][][];&lt;br /&gt;
&lt;br /&gt;
	public void run()&lt;br /&gt;
	{&lt;br /&gt;
&lt;br /&gt;
		setupComPort();&lt;br /&gt;
&lt;br /&gt;
		Frame f = new Frame(&amp;quot;POV Display Controller&amp;quot;);&lt;br /&gt;
		f.setSize(width*px+offX*2, height*px + offY + 20);&lt;br /&gt;
		f.setLayout(new FlowLayout());&lt;br /&gt;
&lt;br /&gt;
		f.addMouseListener(this);&lt;br /&gt;
		f.addMouseMotionListener(this);&lt;br /&gt;
		f.addKeyListener(this);&lt;br /&gt;
&lt;br /&gt;
                eraseCheckbox = new Checkbox(&amp;quot;Erase?&amp;quot;);&lt;br /&gt;
		f.add(eraseCheckbox);&lt;br /&gt;
&lt;br /&gt;
		clearButton = new Button(&amp;quot;Clear Display&amp;quot;);&lt;br /&gt;
		clearButton.addActionListener(this);&lt;br /&gt;
		f.add(clearButton);&lt;br /&gt;
&lt;br /&gt;
		refreshButton = new Button(&amp;quot;Refresh (if the image isn&amp;#039;t appearing)&amp;quot;);&lt;br /&gt;
		refreshButton.addActionListener(this);&lt;br /&gt;
		f.add(refreshButton);&lt;br /&gt;
&lt;br /&gt;
                dumpButton = new Button(&amp;quot;Dump code&amp;quot;);&lt;br /&gt;
		dumpButton.addActionListener(this);&lt;br /&gt;
		//f.add(dumpButton);&lt;br /&gt;
&lt;br /&gt;
		invertButton = new Button(&amp;quot;Invert pixels&amp;quot;);&lt;br /&gt;
		invertButton.addActionListener(this);&lt;br /&gt;
		f.add(invertButton);&lt;br /&gt;
&lt;br /&gt;
		f.setVisible(true);&lt;br /&gt;
		f.addWindowListener(this);&lt;br /&gt;
		f.requestFocus();&lt;br /&gt;
&lt;br /&gt;
		BufferedImage im = new BufferedImage(width*px+1, height*px+1, BufferedImage.TYPE_INT_RGB);&lt;br /&gt;
		Graphics g = im.getGraphics();&lt;br /&gt;
		g.setColor(Color.white);&lt;br /&gt;
		g.fillRect(0, 0, width*px, height*px);&lt;br /&gt;
		g.setColor(Color.black);&lt;br /&gt;
		for(int x = 0; x &amp;lt;=  width*px; x += px) g.drawLine(x, 0, x, height*px);&lt;br /&gt;
		for(int y = 0; y &amp;lt;= height*px; y += px) g.drawLine(0, y,  width*px, y);&lt;br /&gt;
&lt;br /&gt;
		while(true)&lt;br /&gt;
		{&lt;br /&gt;
&lt;br /&gt;
			for(int x = 0; x &amp;lt; width; x += 1)&lt;br /&gt;
			{&lt;br /&gt;
				for(int y = 0; y &amp;lt; height; y += 1)&lt;br /&gt;
				{&lt;br /&gt;
					if(leds[x][y]) g.setColor(Color.red);&lt;br /&gt;
					else           g.setColor(Color.white);&lt;br /&gt;
&lt;br /&gt;
					g.fillRect(x*px+2, y*px+2, px-3, px-3);&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			f.getGraphics().drawImage(im, offX, offY, f);&lt;br /&gt;
			f.requestFocus();&lt;br /&gt;
			try { Thread.sleep(20); }&lt;br /&gt;
			catch(Exception e) {}&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
        void setupComPort() {&lt;br /&gt;
                System.out.print(&amp;quot;PLEASE ENTER A COM PORT NUMBER: &amp;quot;);&lt;br /&gt;
                try {&lt;br /&gt;
                    int com = Integer.parseInt(new BufferedReader(new InputStreamReader(System.in)).readLine());&lt;br /&gt;
                    if(tryComPort(com)) return;&lt;br /&gt;
                    else System.out.println(&amp;quot;That com port doesn&amp;#039;t seem to work! :(&amp;quot;);&lt;br /&gt;
                } catch(Exception e) {&lt;br /&gt;
                    e.printStackTrace();&lt;br /&gt;
                    System.out.println(&amp;quot;Sorry, there was some kind of error! :(&amp;quot;);&lt;br /&gt;
                }&lt;br /&gt;
                System.out.println(&amp;quot;Press any key to exit...&amp;quot;);&lt;br /&gt;
                try {&lt;br /&gt;
                    System.in.read();&lt;br /&gt;
                    System.in.read();&lt;br /&gt;
                } catch(Exception e) {}&lt;br /&gt;
                System.exit(0);&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        boolean tryComPort(int com) {&lt;br /&gt;
                SimpleSerial ss = new SimpleSerialNative(com /*com port!*/);&lt;br /&gt;
                serIn = ss.getInputStream();&lt;br /&gt;
		serOut = ss.getOutputStream();&lt;br /&gt;
&lt;br /&gt;
		return (serIn != null &amp;amp;&amp;amp; serOut != null);&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
	int lastX, lastY;&lt;br /&gt;
&lt;br /&gt;
	int ledX(int mouseX)&lt;br /&gt;
	{&lt;br /&gt;
		return (mouseX - offX)/px;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	int ledY(int mouseY)&lt;br /&gt;
	{&lt;br /&gt;
		return (mouseY - offY)/px;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	boolean inBounds(int x, int y)&lt;br /&gt;
	{&lt;br /&gt;
		return (x &amp;gt;= 0 &amp;amp;&amp;amp; y &amp;gt;= 0 &amp;amp;&amp;amp; x &amp;lt; width &amp;amp;&amp;amp; y &amp;lt; height);&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	void set(int x, int y, boolean state)&lt;br /&gt;
	{&lt;br /&gt;
		if(inBounds(x, y)) leds[x][y] = state;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
	public void mousePressed(MouseEvent e)&lt;br /&gt;
	{&lt;br /&gt;
		lastX = ledX(e.getX());&lt;br /&gt;
		lastY = ledY(e.getY());&lt;br /&gt;
		boolean state = !eraseCheckbox.getState();&lt;br /&gt;
		set(lastX, lastY, state);&lt;br /&gt;
		updateColumn(lastX);&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	public void mouseDragged(MouseEvent e)&lt;br /&gt;
	{&lt;br /&gt;
		int newX = ledX(e.getX());&lt;br /&gt;
		int newY = ledY(e.getY());&lt;br /&gt;
&lt;br /&gt;
		if(newX == lastX &amp;amp;&amp;amp; newY == lastY) return;&lt;br /&gt;
&lt;br /&gt;
		boolean state = !eraseCheckbox.getState();&lt;br /&gt;
		double dist = Math.sqrt((newX-lastX)*(newX-lastX) + (newY-lastY)*(newY-lastY));&lt;br /&gt;
		double dx = (newX - lastX)/dist/10;&lt;br /&gt;
		double dy = (newY - lastY)/dist/10;&lt;br /&gt;
		for(int i = 0; i &amp;lt; dist*10; i++)&lt;br /&gt;
		{&lt;br /&gt;
			int x = (int)(lastX + dx*i);&lt;br /&gt;
			int y = (int)(lastY + dy*i);&lt;br /&gt;
			set(x, y, state);&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		int startCol = (newX &amp;lt; lastX ? newX : lastX);&lt;br /&gt;
		int endCol   = (newX &amp;gt; lastX ? newX : lastX);&lt;br /&gt;
		for(int col = startCol; col &amp;lt;= endCol; col += 1)&lt;br /&gt;
		{&lt;br /&gt;
			updateColumn(col);&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		lastX = newX;&lt;br /&gt;
		lastY = newY;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	void updateColumn(int x)&lt;br /&gt;
	{&lt;br /&gt;
		byte byte1 = (byte)(x &amp;gt;&amp;gt; 8);&lt;br /&gt;
		byte byte2 = (byte)(x &amp;amp; 255);&lt;br /&gt;
		byte byte3 = 0, byte4 = 0;&lt;br /&gt;
&lt;br /&gt;
		//here we assume height = 14&lt;br /&gt;
		for(int y = 0; y &amp;lt; 7; y += 1)&lt;br /&gt;
		{&lt;br /&gt;
			if(leds[x][y]) byte4 |= (1 &amp;lt;&amp;lt; y);&lt;br /&gt;
		}&lt;br /&gt;
		for(int y = 7; y &amp;lt; 14; y += 1)&lt;br /&gt;
		{&lt;br /&gt;
			if(leds[x][y]) byte3 |= (1 &amp;lt;&amp;lt; (y-7));&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		try&lt;br /&gt;
		{&lt;br /&gt;
			serOut.write(byte1);&lt;br /&gt;
			serOut.write(byte2);&lt;br /&gt;
			serOut.write(byte3);&lt;br /&gt;
			serOut.write(byte4);&lt;br /&gt;
			try { Thread.sleep(5); }&lt;br /&gt;
			catch(Exception e) {}&lt;br /&gt;
		}&lt;br /&gt;
		catch(Exception e)&lt;br /&gt;
		{&lt;br /&gt;
			e.printStackTrace();&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	final byte CLEAR = 0x00;&lt;br /&gt;
&lt;br /&gt;
	void sendCommand(byte command)&lt;br /&gt;
	{&lt;br /&gt;
		try&lt;br /&gt;
		{&lt;br /&gt;
			serOut.write(0xff);&lt;br /&gt;
			serOut.write(0xff);&lt;br /&gt;
			serOut.write(0x00);&lt;br /&gt;
			serOut.write(command);&lt;br /&gt;
		}&lt;br /&gt;
		catch(Exception e)&lt;br /&gt;
		{&lt;br /&gt;
			e.printStackTrace();&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	public void actionPerformed(ActionEvent e)&lt;br /&gt;
	{&lt;br /&gt;
		if(e.getSource() == clearButton)&lt;br /&gt;
		{&lt;br /&gt;
			for(int x = 0; x &amp;lt; width; x += 1)&lt;br /&gt;
			{&lt;br /&gt;
				for(int y = 0; y &amp;lt; height; y += 1)&lt;br /&gt;
				{&lt;br /&gt;
					leds[x][y] = false;&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
			sendCommand(CLEAR);&lt;br /&gt;
		}&lt;br /&gt;
		else if(e.getSource() == refreshButton)&lt;br /&gt;
		{&lt;br /&gt;
			for(int x = 0; x &amp;lt; width; x++)&lt;br /&gt;
			{&lt;br /&gt;
				updateColumn(x);&lt;br /&gt;
				try { Thread.sleep(5); } &lt;br /&gt;
				catch(Exception ex) {}&lt;br /&gt;
			}&lt;br /&gt;
		} &lt;br /&gt;
		else if(e.getSource() == dumpButton) &lt;br /&gt;
		{&lt;br /&gt;
			try &lt;br /&gt;
			{ &lt;br /&gt;
				FileWriter fw = new FileWriter(new File(&amp;quot;dump.txt&amp;quot;));&lt;br /&gt;
&lt;br /&gt;
				for(int x = 0; x &amp;lt; width; x++) &lt;br /&gt;
				{&lt;br /&gt;
					fw.write(&amp;quot;pixels[&amp;quot; + x + &amp;quot;][1] = 0b0&amp;quot;);&lt;br /&gt;
					for(int y = 6; y &amp;gt;= 0; y--) fw.write(leds[x][y] ? &amp;quot;1&amp;quot; : &amp;quot;0&amp;quot;); &lt;br /&gt;
					fw.write(&amp;quot;;\r\n&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
					fw.write(&amp;quot;pixels[&amp;quot; + x + &amp;quot;][0] = 0b0&amp;quot;);&lt;br /&gt;
					for(int y = 13; y &amp;gt;= 7; y--) fw.write(leds[x][y] ? &amp;quot;1&amp;quot; : &amp;quot;0&amp;quot;);&lt;br /&gt;
					fw.write(&amp;quot;;\r\n&amp;quot;);&lt;br /&gt;
				}&lt;br /&gt;
&lt;br /&gt;
				fw.flush();&lt;br /&gt;
				fw.close();&lt;br /&gt;
			} &lt;br /&gt;
			catch(Exception ex) {}&lt;br /&gt;
		} &lt;br /&gt;
		else if(e.getSource() == invertButton) {&lt;br /&gt;
			for(int x = 0; x &amp;lt; width; x++) &lt;br /&gt;
			{&lt;br /&gt;
				for(int y = 0; y &amp;lt; 14; y++) &lt;br /&gt;
				{&lt;br /&gt;
					leds[x][y] = !leds[x][y];&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	int asciiCursor = 0;&lt;br /&gt;
	int asciiWidth = 10, asciiHeight = 14;&lt;br /&gt;
	public void keyPressed(KeyEvent e) &lt;br /&gt;
	{&lt;br /&gt;
		&lt;br /&gt;
		char c = e.getKeyChar();&lt;br /&gt;
		if(c &amp;gt;= &amp;#039; &amp;#039; &amp;amp;&amp;amp; c &amp;lt;= &amp;#039;~&amp;#039; &amp;amp;&amp;amp; asciiCursor + asciiWidth &amp;lt; width) &lt;br /&gt;
		{&lt;br /&gt;
			for(int x = 0; x &amp;lt; asciiWidth; x++)&lt;br /&gt;
			{&lt;br /&gt;
				for(int y = 0; y &amp;lt; asciiHeight; y++) &lt;br /&gt;
				{&lt;br /&gt;
					leds[asciiCursor + x][y] |= (ascii[c][y][x] == 1);&lt;br /&gt;
				}&lt;br /&gt;
				updateColumn(x);&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			asciiCursor += asciiWidth;&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		if(e.getKeyCode() == KeyEvent.VK_BACK_SPACE) &lt;br /&gt;
		{&lt;br /&gt;
			if(asciiCursor &amp;gt;= asciiWidth) &lt;br /&gt;
			{&lt;br /&gt;
				asciiCursor -= asciiWidth;&lt;br /&gt;
				for(int x = 0; x &amp;lt; asciiWidth; x++)&lt;br /&gt;
				{&lt;br /&gt;
					for(int y = 0; y &amp;lt; asciiHeight; y++) &lt;br /&gt;
					{&lt;br /&gt;
						leds[asciiCursor + x][y] = false;&lt;br /&gt;
					}&lt;br /&gt;
					updateColumn(x);&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
	public void keyReleased(KeyEvent e) {}&lt;br /&gt;
	public void keyTyped(KeyEvent e) {}&lt;br /&gt;
&lt;br /&gt;
	public void windowActivated(WindowEvent e) {}&lt;br /&gt;
	public void windowClosed(WindowEvent e) {}&lt;br /&gt;
	public void windowClosing(WindowEvent e) { System.exit(0); }&lt;br /&gt;
	public void windowDeactivated(WindowEvent e) {}&lt;br /&gt;
	public void windowDeiconified(WindowEvent e) {}&lt;br /&gt;
	public void windowIconified(WindowEvent e) {}&lt;br /&gt;
	public void windowOpened(WindowEvent e) {}&lt;br /&gt;
																																																	  &lt;br /&gt;
&lt;br /&gt;
//...init# functions omitted (these just initialize ascii[][][])&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Kwang Sim</name></author>
	</entry>
	<entry>
		<id>https://hades.mech.northwestern.edu//index.php?title=AP_KS_GM-POVInput.java&amp;diff=11794</id>
		<title>AP KS GM-POVInput.java</title>
		<link rel="alternate" type="text/html" href="https://hades.mech.northwestern.edu//index.php?title=AP_KS_GM-POVInput.java&amp;diff=11794"/>
		<updated>2009-03-19T09:26:07Z</updated>

		<summary type="html">&lt;p&gt;Kwang Sim: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;pre&amp;gt;/**********************************************&lt;br /&gt;
 * pov.c&lt;br /&gt;
 * Author:Greg McGlynn&lt;br /&gt;
 * Persistence-of-Vision Display project&lt;br /&gt;
 * Alexander Park, Kwang Xiong Sim, Grag McGlynn&lt;br /&gt;
 * ME 333 Mechatronics - Winter 2008&lt;br /&gt;
 * Northwestern University&lt;br /&gt;
 *&lt;br /&gt;
 *    This code uses the SimpleSerial code found at&lt;br /&gt;
 * http://alumni.media.mit.edu/~benres/simpleserial/&lt;br /&gt;
 * It lets you talk serial from a Java program on a Windows PC.&lt;br /&gt;
 * Java programmers may find this useful for a project.&lt;br /&gt;
 *&lt;br /&gt;
 *    This code runs on a PC and talks through a serial port to&lt;br /&gt;
 * the POV. This code is hacked together, ugly, and uncommented!&lt;br /&gt;
 * Read at your own risk!&lt;br /&gt;
 **********************************************/&lt;br /&gt;
&lt;br /&gt;
import java.awt.*;&lt;br /&gt;
import java.awt.image.*;&lt;br /&gt;
import java.awt.event.*;&lt;br /&gt;
import javax.swing.event.*;&lt;br /&gt;
import java.io.*;&lt;br /&gt;
&lt;br /&gt;
public class POVController extends MouseInputAdapter implements ActionListener, KeyListener, WindowListener&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
	public static void main(String[] args)&lt;br /&gt;
	{&lt;br /&gt;
                //initialization necessary to accept keyboard input (very long functions), not shown&lt;br /&gt;
		init();&lt;br /&gt;
		init2();&lt;br /&gt;
		init3();&lt;br /&gt;
		init4();&lt;br /&gt;
&lt;br /&gt;
		new POVController().run();&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	InputStream serIn;&lt;br /&gt;
	OutputStream serOut; //we talk to the display with this&lt;br /&gt;
&lt;br /&gt;
        //the image:&lt;br /&gt;
        boolean[][] leds = new boolean[width][height];&lt;br /&gt;
&lt;br /&gt;
        //user interface stuff:&lt;br /&gt;
	final int px = 6;&lt;br /&gt;
	final int width = 193;&lt;br /&gt;
	final int height = 14;&lt;br /&gt;
&lt;br /&gt;
	final int offX = 10;&lt;br /&gt;
	final int offY = 100;&lt;br /&gt;
&lt;br /&gt;
	Checkbox eraseCheckbox;&lt;br /&gt;
	Button clearButton;&lt;br /&gt;
	Button refreshButton;&lt;br /&gt;
	Button dumpButton;&lt;br /&gt;
	Button invertButton;&lt;br /&gt;
&lt;br /&gt;
	static int[][][] ascii = new int[255][][];&lt;br /&gt;
&lt;br /&gt;
	public void run()&lt;br /&gt;
	{&lt;br /&gt;
&lt;br /&gt;
		setupComPort();&lt;br /&gt;
&lt;br /&gt;
		Frame f = new Frame(&amp;quot;POV Display Controller&amp;quot;);&lt;br /&gt;
		f.setSize(width*px+offX*2, height*px + offY + 20);&lt;br /&gt;
		f.setLayout(new FlowLayout());&lt;br /&gt;
&lt;br /&gt;
		f.addMouseListener(this);&lt;br /&gt;
		f.addMouseMotionListener(this);&lt;br /&gt;
		f.addKeyListener(this);&lt;br /&gt;
&lt;br /&gt;
                eraseCheckbox = new Checkbox(&amp;quot;Erase?&amp;quot;);&lt;br /&gt;
		f.add(eraseCheckbox);&lt;br /&gt;
&lt;br /&gt;
		clearButton = new Button(&amp;quot;Clear Display&amp;quot;);&lt;br /&gt;
		clearButton.addActionListener(this);&lt;br /&gt;
		f.add(clearButton);&lt;br /&gt;
&lt;br /&gt;
		refreshButton = new Button(&amp;quot;Refresh (if the image isn&amp;#039;t appearing)&amp;quot;);&lt;br /&gt;
		refreshButton.addActionListener(this);&lt;br /&gt;
		f.add(refreshButton);&lt;br /&gt;
&lt;br /&gt;
                dumpButton = new Button(&amp;quot;Dump code&amp;quot;);&lt;br /&gt;
		dumpButton.addActionListener(this);&lt;br /&gt;
		//f.add(dumpButton);&lt;br /&gt;
&lt;br /&gt;
		invertButton = new Button(&amp;quot;Invert pixels&amp;quot;);&lt;br /&gt;
		invertButton.addActionListener(this);&lt;br /&gt;
		f.add(invertButton);&lt;br /&gt;
&lt;br /&gt;
		f.setVisible(true);&lt;br /&gt;
		f.addWindowListener(this);&lt;br /&gt;
		f.requestFocus();&lt;br /&gt;
&lt;br /&gt;
		BufferedImage im = new BufferedImage(width*px+1, height*px+1, BufferedImage.TYPE_INT_RGB);&lt;br /&gt;
		Graphics g = im.getGraphics();&lt;br /&gt;
		g.setColor(Color.white);&lt;br /&gt;
		g.fillRect(0, 0, width*px, height*px);&lt;br /&gt;
		g.setColor(Color.black);&lt;br /&gt;
		for(int x = 0; x &amp;lt;=  width*px; x += px) g.drawLine(x, 0, x, height*px);&lt;br /&gt;
		for(int y = 0; y &amp;lt;= height*px; y += px) g.drawLine(0, y,  width*px, y);&lt;br /&gt;
&lt;br /&gt;
		while(true)&lt;br /&gt;
		{&lt;br /&gt;
&lt;br /&gt;
			for(int x = 0; x &amp;lt; width; x += 1)&lt;br /&gt;
			{&lt;br /&gt;
				for(int y = 0; y &amp;lt; height; y += 1)&lt;br /&gt;
				{&lt;br /&gt;
					if(leds[x][y]) g.setColor(Color.red);&lt;br /&gt;
					else           g.setColor(Color.white);&lt;br /&gt;
&lt;br /&gt;
					g.fillRect(x*px+2, y*px+2, px-3, px-3);&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			f.getGraphics().drawImage(im, offX, offY, f);&lt;br /&gt;
			f.requestFocus();&lt;br /&gt;
			try { Thread.sleep(20); }&lt;br /&gt;
			catch(Exception e) {}&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
        void setupComPort() {&lt;br /&gt;
                System.out.print(&amp;quot;PLEASE ENTER A COM PORT NUMBER: &amp;quot;);&lt;br /&gt;
                try {&lt;br /&gt;
                    int com = Integer.parseInt(new BufferedReader(new InputStreamReader(System.in)).readLine());&lt;br /&gt;
                    if(tryComPort(com)) return;&lt;br /&gt;
                    else System.out.println(&amp;quot;That com port doesn&amp;#039;t seem to work! :(&amp;quot;);&lt;br /&gt;
                } catch(Exception e) {&lt;br /&gt;
                    e.printStackTrace();&lt;br /&gt;
                    System.out.println(&amp;quot;Sorry, there was some kind of error! :(&amp;quot;);&lt;br /&gt;
                }&lt;br /&gt;
                System.out.println(&amp;quot;Press any key to exit...&amp;quot;);&lt;br /&gt;
                try {&lt;br /&gt;
                    System.in.read();&lt;br /&gt;
                    System.in.read();&lt;br /&gt;
                } catch(Exception e) {}&lt;br /&gt;
                System.exit(0);&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        boolean tryComPort(int com) {&lt;br /&gt;
                SimpleSerial ss = new SimpleSerialNative(com /*com port!*/);&lt;br /&gt;
                serIn = ss.getInputStream();&lt;br /&gt;
		serOut = ss.getOutputStream();&lt;br /&gt;
&lt;br /&gt;
		return (serIn != null &amp;amp;&amp;amp; serOut != null);&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
	int lastX, lastY;&lt;br /&gt;
&lt;br /&gt;
	int ledX(int mouseX)&lt;br /&gt;
	{&lt;br /&gt;
		return (mouseX - offX)/px;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	int ledY(int mouseY)&lt;br /&gt;
	{&lt;br /&gt;
		return (mouseY - offY)/px;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	boolean inBounds(int x, int y)&lt;br /&gt;
	{&lt;br /&gt;
		return (x &amp;gt;= 0 &amp;amp;&amp;amp; y &amp;gt;= 0 &amp;amp;&amp;amp; x &amp;lt; width &amp;amp;&amp;amp; y &amp;lt; height);&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	void set(int x, int y, boolean state)&lt;br /&gt;
	{&lt;br /&gt;
		if(inBounds(x, y)) leds[x][y] = state;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
	public void mousePressed(MouseEvent e)&lt;br /&gt;
	{&lt;br /&gt;
		lastX = ledX(e.getX());&lt;br /&gt;
		lastY = ledY(e.getY());&lt;br /&gt;
		boolean state = !eraseCheckbox.getState();&lt;br /&gt;
		set(lastX, lastY, state);&lt;br /&gt;
		updateColumn(lastX);&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	public void mouseDragged(MouseEvent e)&lt;br /&gt;
	{&lt;br /&gt;
		int newX = ledX(e.getX());&lt;br /&gt;
		int newY = ledY(e.getY());&lt;br /&gt;
&lt;br /&gt;
		if(newX == lastX &amp;amp;&amp;amp; newY == lastY) return;&lt;br /&gt;
&lt;br /&gt;
		boolean state = !eraseCheckbox.getState();&lt;br /&gt;
		double dist = Math.sqrt((newX-lastX)*(newX-lastX) + (newY-lastY)*(newY-lastY));&lt;br /&gt;
		double dx = (newX - lastX)/dist/10;&lt;br /&gt;
		double dy = (newY - lastY)/dist/10;&lt;br /&gt;
		for(int i = 0; i &amp;lt; dist*10; i++)&lt;br /&gt;
		{&lt;br /&gt;
			int x = (int)(lastX + dx*i);&lt;br /&gt;
			int y = (int)(lastY + dy*i);&lt;br /&gt;
			set(x, y, state);&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		int startCol = (newX &amp;lt; lastX ? newX : lastX);&lt;br /&gt;
		int endCol   = (newX &amp;gt; lastX ? newX : lastX);&lt;br /&gt;
		for(int col = startCol; col &amp;lt;= endCol; col += 1)&lt;br /&gt;
		{&lt;br /&gt;
			updateColumn(col);&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		lastX = newX;&lt;br /&gt;
		lastY = newY;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	void updateColumn(int x)&lt;br /&gt;
	{&lt;br /&gt;
		byte byte1 = (byte)(x &amp;gt;&amp;gt; 8);&lt;br /&gt;
		byte byte2 = (byte)(x &amp;amp; 255);&lt;br /&gt;
		byte byte3 = 0, byte4 = 0;&lt;br /&gt;
&lt;br /&gt;
		//here we assume height = 14&lt;br /&gt;
		for(int y = 0; y &amp;lt; 7; y += 1)&lt;br /&gt;
		{&lt;br /&gt;
			if(leds[x][y]) byte4 |= (1 &amp;lt;&amp;lt; y);&lt;br /&gt;
		}&lt;br /&gt;
		for(int y = 7; y &amp;lt; 14; y += 1)&lt;br /&gt;
		{&lt;br /&gt;
			if(leds[x][y]) byte3 |= (1 &amp;lt;&amp;lt; (y-7));&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		try&lt;br /&gt;
		{&lt;br /&gt;
			serOut.write(byte1);&lt;br /&gt;
			serOut.write(byte2);&lt;br /&gt;
			serOut.write(byte3);&lt;br /&gt;
			serOut.write(byte4);&lt;br /&gt;
			try { Thread.sleep(5); }&lt;br /&gt;
			catch(Exception e) {}&lt;br /&gt;
		}&lt;br /&gt;
		catch(Exception e)&lt;br /&gt;
		{&lt;br /&gt;
			e.printStackTrace();&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	final byte CLEAR = 0x00;&lt;br /&gt;
&lt;br /&gt;
	void sendCommand(byte command)&lt;br /&gt;
	{&lt;br /&gt;
		try&lt;br /&gt;
		{&lt;br /&gt;
			serOut.write(0xff);&lt;br /&gt;
			serOut.write(0xff);&lt;br /&gt;
			serOut.write(0x00);&lt;br /&gt;
			serOut.write(command);&lt;br /&gt;
		}&lt;br /&gt;
		catch(Exception e)&lt;br /&gt;
		{&lt;br /&gt;
			e.printStackTrace();&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	public void actionPerformed(ActionEvent e)&lt;br /&gt;
	{&lt;br /&gt;
		if(e.getSource() == clearButton)&lt;br /&gt;
		{&lt;br /&gt;
			for(int x = 0; x &amp;lt; width; x += 1)&lt;br /&gt;
			{&lt;br /&gt;
				for(int y = 0; y &amp;lt; height; y += 1)&lt;br /&gt;
				{&lt;br /&gt;
					leds[x][y] = false;&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
			sendCommand(CLEAR);&lt;br /&gt;
		}&lt;br /&gt;
		else if(e.getSource() == refreshButton)&lt;br /&gt;
		{&lt;br /&gt;
			for(int x = 0; x &amp;lt; width; x++)&lt;br /&gt;
			{&lt;br /&gt;
				updateColumn(x);&lt;br /&gt;
				try { Thread.sleep(5); } &lt;br /&gt;
				catch(Exception ex) {}&lt;br /&gt;
			}&lt;br /&gt;
		} &lt;br /&gt;
		else if(e.getSource() == dumpButton) &lt;br /&gt;
		{&lt;br /&gt;
			try &lt;br /&gt;
			{ &lt;br /&gt;
				FileWriter fw = new FileWriter(new File(&amp;quot;dump.txt&amp;quot;));&lt;br /&gt;
&lt;br /&gt;
				for(int x = 0; x &amp;lt; width; x++) &lt;br /&gt;
				{&lt;br /&gt;
					fw.write(&amp;quot;pixels[&amp;quot; + x + &amp;quot;][1] = 0b0&amp;quot;);&lt;br /&gt;
					for(int y = 6; y &amp;gt;= 0; y--) fw.write(leds[x][y] ? &amp;quot;1&amp;quot; : &amp;quot;0&amp;quot;); &lt;br /&gt;
					fw.write(&amp;quot;;\r\n&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
					fw.write(&amp;quot;pixels[&amp;quot; + x + &amp;quot;][0] = 0b0&amp;quot;);&lt;br /&gt;
					for(int y = 13; y &amp;gt;= 7; y--) fw.write(leds[x][y] ? &amp;quot;1&amp;quot; : &amp;quot;0&amp;quot;);&lt;br /&gt;
					fw.write(&amp;quot;;\r\n&amp;quot;);&lt;br /&gt;
				}&lt;br /&gt;
&lt;br /&gt;
				fw.flush();&lt;br /&gt;
				fw.close();&lt;br /&gt;
			} &lt;br /&gt;
			catch(Exception ex) {}&lt;br /&gt;
		} &lt;br /&gt;
		else if(e.getSource() == invertButton) {&lt;br /&gt;
			for(int x = 0; x &amp;lt; width; x++) &lt;br /&gt;
			{&lt;br /&gt;
				for(int y = 0; y &amp;lt; 14; y++) &lt;br /&gt;
				{&lt;br /&gt;
					leds[x][y] = !leds[x][y];&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	int asciiCursor = 0;&lt;br /&gt;
	int asciiWidth = 10, asciiHeight = 14;&lt;br /&gt;
	public void keyPressed(KeyEvent e) &lt;br /&gt;
	{&lt;br /&gt;
		&lt;br /&gt;
		char c = e.getKeyChar();&lt;br /&gt;
		if(c &amp;gt;= &amp;#039; &amp;#039; &amp;amp;&amp;amp; c &amp;lt;= &amp;#039;~&amp;#039; &amp;amp;&amp;amp; asciiCursor + asciiWidth &amp;lt; width) &lt;br /&gt;
		{&lt;br /&gt;
			for(int x = 0; x &amp;lt; asciiWidth; x++)&lt;br /&gt;
			{&lt;br /&gt;
				for(int y = 0; y &amp;lt; asciiHeight; y++) &lt;br /&gt;
				{&lt;br /&gt;
					leds[asciiCursor + x][y] |= (ascii[c][y][x] == 1);&lt;br /&gt;
				}&lt;br /&gt;
				updateColumn(x);&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			asciiCursor += asciiWidth;&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		if(e.getKeyCode() == KeyEvent.VK_BACK_SPACE) &lt;br /&gt;
		{&lt;br /&gt;
			if(asciiCursor &amp;gt;= asciiWidth) &lt;br /&gt;
			{&lt;br /&gt;
				asciiCursor -= asciiWidth;&lt;br /&gt;
				for(int x = 0; x &amp;lt; asciiWidth; x++)&lt;br /&gt;
				{&lt;br /&gt;
					for(int y = 0; y &amp;lt; asciiHeight; y++) &lt;br /&gt;
					{&lt;br /&gt;
						leds[asciiCursor + x][y] = false;&lt;br /&gt;
					}&lt;br /&gt;
					updateColumn(x);&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
	public void keyReleased(KeyEvent e) {}&lt;br /&gt;
	public void keyTyped(KeyEvent e) {}&lt;br /&gt;
&lt;br /&gt;
	public void windowActivated(WindowEvent e) {}&lt;br /&gt;
	public void windowClosed(WindowEvent e) {}&lt;br /&gt;
	public void windowClosing(WindowEvent e) { System.exit(0); }&lt;br /&gt;
	public void windowDeactivated(WindowEvent e) {}&lt;br /&gt;
	public void windowDeiconified(WindowEvent e) {}&lt;br /&gt;
	public void windowIconified(WindowEvent e) {}&lt;br /&gt;
	public void windowOpened(WindowEvent e) {}&lt;br /&gt;
																																																	  &lt;br /&gt;
&lt;br /&gt;
//...init# functions omitted (these just initialize ascii[][][])&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Kwang Sim</name></author>
	</entry>
	<entry>
		<id>https://hades.mech.northwestern.edu//index.php?title=Persistence-of-Vision_Display&amp;diff=11770</id>
		<title>Persistence-of-Vision Display</title>
		<link rel="alternate" type="text/html" href="https://hades.mech.northwestern.edu//index.php?title=Persistence-of-Vision_Display&amp;diff=11770"/>
		<updated>2009-03-19T06:55:28Z</updated>

		<summary type="html">&lt;p&gt;Kwang Sim: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Team Members ==&lt;br /&gt;
[[image:POV|right]]&lt;br /&gt;
* Gregory McGlynn(Computer Science, Class of 2011) [left]&lt;br /&gt;
* Kwang Xiong Sim (Mechanical Engineering, Class of 2010) [center]&lt;br /&gt;
* Alexander Park (Material Science, Class of 2009) [right]&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
The purpose of this project was to create a display using the concept of Persistence of Vision. Essentially, we created a rotating platform that spins a column of LEDs. By controlling the frequency of blinking on each LED, and synchronizing it with the rate of rotation of the platform, we can tune the moving column of LEDs to display a desired image. &lt;br /&gt;
&lt;br /&gt;
== Theory of Persistence of Vision ==&lt;br /&gt;
Although arguably much more complex, human vision functions in a manner similar to modern motion pictures; our eyes retain images for a fraction of a second, not unlike a frame in a movie. This is called the persistence of vision (POV).  When images change fast enough, what we see is a subtle blend of what we see now and a fraction of a second ago. &lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
[[image:POVschematic|center]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We mounted a platform atop the output shaft of a motor. In order to avoid the complication of wiring a spinning object, all of the major components of the POV display are built on this platform, including a PIC microcontroller, a strip of LEDs, and a battery pack to power the assembly. The strip of LEDs will be mounted vertically at an extended end of the platform. In order to stabilize the spinning motion, the components are positioned so that the center of gravity of the panel passes through the axis of rotation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We made use of wireless communication between two PICs to implement live updating of the display based on user input. One PIC will be used to control the POV display and receive wireless information from a second PIC. The second PIC will receive user input store user input and transmit the data wirelessly to the POV’s PIC.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The POV display has two modes of operation. In mode 1, the PIC on the control panel transmits data that we had previously stored in it to the PIC on the rotor panel. By varying the resistance of a potentiometer on the control panel, we allow the user to choose between ten pre-stored messages. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In mode 2 of operation, the PIC on the control panel is connected to a computer via a USB port. Using a Java program that we wrote, we allow the user to draw pictures or type letters which will get updated real time on the POV display. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In order to ensure accurate portrayal of the desired image, we used a hall sensor to implement position sensing. We wired in a hall sensor towards the end of the rotor display panel and attached a magnet on the top of the base box. The magnet was positioned on the orbiting path of the hall sensor so that it registers a signal everytime it spins a round. We have programmed the display to reset the image cycle everytime the hall sensor was triggered so that the image stays at the same location.&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Mechanical Design ==&lt;br /&gt;
[[image:POV_CADdrawing|center]]&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Base Box ===&lt;br /&gt;
As seen in the above drawing, the base box is built out of rigid expanded PVC. There are 3 rectangle faces, 2 trapezium faces and a door that is hinged at the base so that it opens outwards. The control panel is mounted on the inner face of the door.&lt;br /&gt;
&lt;br /&gt;
An addition wooden base is mounted to the base to increase rigidity of base-to-wall connections and also to weight down the whole setup and make it more stable. A slot is cut towards the back to stick in the motor. &lt;br /&gt;
&lt;br /&gt;
A aluminum coupler is attached to the motor shaft which comes out of the top of the box through a radial bearing. The radial bearing can reduce the degree of freedom of the spinning shaft so it only spins in the vertical axis. It may also be used to support the weight of the rotating display panel of that the whole weight does not rest on the motor shaft. The end of the coupler is milled to a strip that locks in to a complementary hole in the rotating display panel. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Control Panel ===&lt;br /&gt;
&lt;br /&gt;
There are switches that we need to put on the control panel. &lt;br /&gt;
1) Turns motor on/off&lt;br /&gt;
2) Control motor speed&lt;br /&gt;
3) Choose stored response&lt;br /&gt;
4) Invoke stored response&lt;br /&gt;
5) Scroll the message&lt;br /&gt;
6) Set scroll speed for message&lt;br /&gt;
&lt;br /&gt;
The first control was a simple toggle switch wired between the two motor leads. The second control is a potentiometer wired between the motor, by turning the potentiometer to increase resistance, we can lower the motor speed.&lt;br /&gt;
&lt;br /&gt;
The third control is implemented by a potentiometer with ten different markings, each corresponding to a stored message. We set the control panel PIC code to recognize ten different intervals of resistance controlled by the potentiometer. After the resistance is set on control 3, pressing button 4 will ask the PIC to grab this resistance value and display the right stored response. &lt;br /&gt;
&lt;br /&gt;
Control 5 and 6 are both implemented by potentiometers. Control 5 allows users to scroll the message manually and control 6 allows the user to set the speed at which the message scrolls around. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Rotating Display Panel ===&lt;br /&gt;
&lt;br /&gt;
== Electrical Design ==&lt;br /&gt;
&lt;br /&gt;
=== Primary Components ===&lt;br /&gt;
&lt;br /&gt;
=== Rotating Display Circuit ===&lt;br /&gt;
[[Image:POVschematicsmall.jpg|400px|right|Display circuit]]&lt;br /&gt;
The rotating display has 14 LEDs which are controlled by a PIC. The LEDs are bright and require a good deal of current, which cannot be supplied directly from the output ports of the PIC. Therefore the LEDs are controlled through two Darlington arrays (DS2003). These ICs consist of 7 Darlington pair transistors with a common emitter. The outputs of the PIC are connected to the bases of the transistors. Thus when the PIC drives one of the bases high, current can flow through the transistor and the corresponding LED lights up. We did not find it necessary to use any resistors in this design.&lt;br /&gt;
&lt;br /&gt;
The display uses a [[Hall Effect Sensor]] to synchronize its display with its rotation. The circuit as shown causes pin B0 on the PIC to go low whenever the hall sensor is near a magnet. A magnet is mounted at a fixed location under the display so that when the PIC detects this falling edge on pin B0 it knows that it is positioned above the magnet. By timing the interval between two of these events the PIC calculates how fast the display is rotating and adjusts its timing accordingly.&lt;br /&gt;
&lt;br /&gt;
The display receives commands via an [[XBee radio communication between PICs|XBee]] radio module.&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot;&amp;gt;&lt;br /&gt;
=== Control Panel Circuit ===&lt;br /&gt;
[[Image:AP_KS_GM=Control_panel_schematic.jpg|400px|right|Control panel circuit]]&lt;br /&gt;
&lt;br /&gt;
The control panel receives user input through three potentiometers and a pushbutton. The states of these controls are read by the PIC which uses its XBee radio module to send appropriate commands to the display.&lt;br /&gt;
&lt;br /&gt;
If the USB cable is plugged in, the control panel is also responsible for accepting commands from the PC and relaying these commands to the POV through the XBee.&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot;&amp;gt;&lt;br /&gt;
== Code ==&lt;br /&gt;
&lt;br /&gt;
[[AP_KS_GM-control_panel_code.c|Code for the control panel PIC]]&lt;br /&gt;
&lt;br /&gt;
[[AP_KS_GM-pov_code.c|Code for the display PIC]]&lt;br /&gt;
&lt;br /&gt;
[[AP_KS_GM-POVInput.java|Code for the PC applet]]&lt;br /&gt;
&lt;br /&gt;
== Results ==&lt;br /&gt;
=== Mode 1: Canned Response ===&lt;br /&gt;
In the first mode of operation, a user can just plug in the POV display into a wall socket, turn on the device and display an image immediately. This will allow a quick and easy demonstration without a computer. We have stored ten different responses on the PIC ROM sitting on the rotating display panel. Using a potentiometer, the device allow the user to set which canned response is being displayed.&lt;br /&gt;
&lt;br /&gt;
video link to mode 1 &lt;br /&gt;
&lt;br /&gt;
=== Mode 2: Real time image input ===&lt;br /&gt;
In the second mode of operation, a user can interact more closely with the POV display. In this mode, the POV  display is connected via a USB port to a computer which needs to have Java installed. The Java program with the code listed above allows a user to draw pictures or type letters which will be tranmitted real time from the control panel PIC to the rotating display panel PIC through the wireless Xbee chips.&lt;br /&gt;
&lt;br /&gt;
In both modes of operation, we have set up knobs that will allow a user to scroll a message manually or set the scroll speed of an image. &lt;br /&gt;
&lt;br /&gt;
video link to mode 2&lt;br /&gt;
&lt;br /&gt;
== Additional Notes ==&lt;br /&gt;
=== Possible Future Improvements/Enhancements ===&lt;br /&gt;
We have thought about using RGB LEDS to give the display panel more colorful. Also, we can use different sensors to make the display more interactive. For example putting on distance sensors on the display so that the panel color scheme changes when you wave a hand in front of it.&lt;/div&gt;</summary>
		<author><name>Kwang Sim</name></author>
	</entry>
	<entry>
		<id>https://hades.mech.northwestern.edu//index.php?title=Persistence-of-Vision_Display&amp;diff=11766</id>
		<title>Persistence-of-Vision Display</title>
		<link rel="alternate" type="text/html" href="https://hades.mech.northwestern.edu//index.php?title=Persistence-of-Vision_Display&amp;diff=11766"/>
		<updated>2009-03-19T06:20:17Z</updated>

		<summary type="html">&lt;p&gt;Kwang Sim: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Team Members ==&lt;br /&gt;
[[image:POV|right]]&lt;br /&gt;
* Gregory McGlynn(Computer Science, Class of 2011) [left]&lt;br /&gt;
* Kwang Xiong Sim (Mechanical Engineering, Class of 2010) [center]&lt;br /&gt;
* Alexander Park (Material Science, Class of 2010) [right]&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
The purpose of this project was to create a display using the concept of Persistence of Vision. Essentially, we created a rotating platform that spins a column of LEDs. By controlling the frequency of blinking on each LED, and synchronizing it with the rate of rotation of the platform, we can tune the moving column of LEDs to display a desired image. &lt;br /&gt;
&lt;br /&gt;
== Theory of Persistence of Vision ==&lt;br /&gt;
Although arguably much more complex, human vision functions in a manner similar to modern motion pictures; our eyes retain images for a fraction of a second, not unlike a frame in a movie. This is called the persistence of vision (POV).  When images change fast enough, what we see is a subtle blend of what we see now and a fraction of a second ago. &lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
[[image:POVschematic|center]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We mounted a platform atop the output shaft of a motor. In order to avoid the complication of wiring a spinning object, all of the major components of the POV display are built on this platform, including a PIC microcontroller, a strip of LEDs, and a battery pack to power the assembly. The strip of LEDs will be mounted vertically at an extended end of the platform. In order to stabilize the spinning motion, the components are positioned so that the center of gravity of the panel passes through the axis of rotation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We made use of wireless communication between two PICs to implement live updating of the display based on user input. One PIC will be used to control the POV display and receive wireless information from a second PIC. The second PIC will receive user input store user input and transmit the data wirelessly to the POV’s PIC.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The POV display has two modes of operation. In mode 1, the PIC on the control panel transmits data that we had previously stored in it to the PIC on the rotor panel. By varying the resistance of a potentiometer on the control panel, we allow the user to choose between ten pre-stored messages. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In mode 2 of operation, the PIC on the control panel is connected to a computer via a USB port. Using a Java program that we wrote, we allow the user to draw pictures or type letters which will get updated real time on the POV display. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In order to ensure accurate portrayal of the desired image, we used a hall sensor to implement position sensing. We wired in a hall sensor towards the end of the rotor display panel and attached a magnet on the top of the base box. The magnet was positioned on the orbiting path of the hall sensor so that it registers a signal everytime it spins a round. We have programmed the display to reset the image cycle everytime the hall sensor was triggered so that the image stays at the same location.&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Mechanical Design ==&lt;br /&gt;
[[image:POV_CADdrawing|center]]&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Base Box ===&lt;br /&gt;
As seen in the above drawing, the base box is built out of rigid expanded PVC. There are 3 rectangle faces, 2 trapezium faces and a door that is hinged at the base so that it opens outwards. The control panel is mounted on the inner face  &lt;br /&gt;
&lt;br /&gt;
=== Control Panel ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Rotating Display Panel ===&lt;br /&gt;
&lt;br /&gt;
== Electrical Design ==&lt;br /&gt;
&lt;br /&gt;
=== Primary Components ===&lt;br /&gt;
&lt;br /&gt;
=== Rotating Display Circuit ===&lt;br /&gt;
[[Image:POVschematicsmall.jpg|400px|right|Display circuit]]&lt;br /&gt;
The rotating display has 14 LEDs which are controlled by a PIC. The LEDs are bright and require a good deal of current, which cannot be supplied directly from the output ports of the PIC. Therefore the LEDs are controlled through two Darlington arrays (DS2003). These ICs consist of 7 Darlington pair transistors with a common emitter. The outputs of the PIC are connected to the bases of the transistors. Thus when the PIC drives one of the bases high, current can flow through the transistor and the corresponding LED lights up. We did not find it necessary to use any resistors in this design.&lt;br /&gt;
&lt;br /&gt;
The display uses a [[Hall Effect Sensor]] to synchronize its display with its rotation. The circuit as shown causes pin B0 on the PIC to go low whenever the hall sensor is near a magnet. A magnet is mounted at a fixed location under the display so that when the PIC detects this falling edge on pin B0 it knows that it is positioned above the magnet. By timing the interval between two of these events the PIC calculates how fast the display is rotating and adjusts its timing accordingly.&lt;br /&gt;
&lt;br /&gt;
The display receives commands via an [[XBee radio communication between PICs|XBee]] radio module.&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot;&amp;gt;&lt;br /&gt;
=== Control Panel Circuit ===&lt;br /&gt;
[[Image:AP_KS_GM=Control_panel_schematic.jpg|400px|right|Control panel circuit]]&lt;br /&gt;
&lt;br /&gt;
The control panel receives user input through three potentiometers and a pushbutton. The states of these controls are read by the PIC which uses its XBee radio module to send appropriate commands to the display.&lt;br /&gt;
&lt;br /&gt;
If the USB cable is plugged in, the control panel is also responsible for accepting commands from the PC and relaying these commands to the POV through the XBee.&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot;&amp;gt;&lt;br /&gt;
== Code ==&lt;br /&gt;
&lt;br /&gt;
[[AP_KS_GM-control_panel_code.c|Code for the control panel PIC]]&lt;br /&gt;
&lt;br /&gt;
[[AP_KS_GM-pov_code.c|Code for the display PIC]]&lt;br /&gt;
&lt;br /&gt;
[[AP_KS_GM-POVInput.java|Code for the PC applet]]&lt;br /&gt;
&lt;br /&gt;
== Results ==&lt;br /&gt;
=== Mode 1: Canned Response ===&lt;br /&gt;
In the first mode of operation, a user can just plug in the POV display into a wall socket, turn on the device and display an image immediately. This will allow a quick and easy demonstration without a computer. We have stored ten different responses on the PIC ROM sitting on the rotating display panel. Using a potentiometer, the device allow the user to set which canned response is being displayed.&lt;br /&gt;
&lt;br /&gt;
video link to mode 1 &lt;br /&gt;
&lt;br /&gt;
=== Mode 2: Real time image input ===&lt;br /&gt;
In the second mode of operation, a user can interact more closely with the POV display. In this mode, the POV  display is connected via a USB port to a computer which needs to have Java installed. The Java program with the code listed above allows a user to draw pictures or type letters which will be tranmitted real time from the control panel PIC to the rotating display panel PIC through the wireless Xbee chips.&lt;br /&gt;
&lt;br /&gt;
In both modes of operation, we have set up knobs that will allow a user to scroll a message manually or set the scroll speed of an image. &lt;br /&gt;
&lt;br /&gt;
video link to mode 2&lt;br /&gt;
&lt;br /&gt;
== Additional Notes ==&lt;br /&gt;
=== Possible Future Improvements/Enhancements ===&lt;br /&gt;
We have thought about using RGB LEDS to give the display panel more colorful. Also, we can use different sensors to make the display more interactive. For example putting on distance sensors on the display so that the panel color scheme changes when you wave a hand in front of it.&lt;/div&gt;</summary>
		<author><name>Kwang Sim</name></author>
	</entry>
	<entry>
		<id>https://hades.mech.northwestern.edu//index.php?title=POV_display&amp;diff=11762</id>
		<title>POV display</title>
		<link rel="alternate" type="text/html" href="https://hades.mech.northwestern.edu//index.php?title=POV_display&amp;diff=11762"/>
		<updated>2009-03-19T06:16:05Z</updated>

		<summary type="html">&lt;p&gt;Kwang Sim: Redirecting to Persistence-of-Vision Display&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#REDIRECT [[Persistence-of-Vision Display]]&lt;/div&gt;</summary>
		<author><name>Kwang Sim</name></author>
	</entry>
	<entry>
		<id>https://hades.mech.northwestern.edu//index.php?title=POV&amp;diff=11760</id>
		<title>POV</title>
		<link rel="alternate" type="text/html" href="https://hades.mech.northwestern.edu//index.php?title=POV&amp;diff=11760"/>
		<updated>2009-03-19T06:15:24Z</updated>

		<summary type="html">&lt;p&gt;Kwang Sim: Redirecting to Persistence-of-Vision Display&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#REDIRECT [[Persistence-of-Vision Display]]&lt;/div&gt;</summary>
		<author><name>Kwang Sim</name></author>
	</entry>
</feed>