Set-up: So i wanted to give you guys an introduction but since i never read those of others and just skip to the fun parts, so i'll skip the school part and tell you about the machine my schoolmates and i designed. It's function is to dose golfballs in colored boxes. Also we wanted to set the amount of golfballs per colored box through a wireless device, we chose an android phone.
The elements in this project are: Color detection, simpel I/O usage, wireless connection and an interface for the android phone.
ARM: To achieve the i/o we chose the board on the left(STM32L-Discovery). It features a lot of functions but almost NO documentation. The cheaper version, STM32VL-Discovery, does have a lot of documentation and a nice community but since the chip on the board is different there is a small difference in the API. Why they did that i'll never know but it was a pain figuring out how to make use of some of the functions!
Moving on, so we use the simple i/o to drive some motors to make the golfballs go in the correct box and drive the RGB-LED for the color detection. The color detection works as follow: we shine certain colors on to the object and measure the reflection current generated by the photodiode. The color that generated the highest current will be the color of the box. The current generated by the photodiode is converted to a voltage wich can be measured with the ADC function of the STM32L-Discovery.
There is one problem not adressed: the phone sends a command via bluetooth but how does the STM32L receive this command?
This can be solved by using a bluetooth module but can also be accomplished a little bit easier by using a IOIO
This little PCB connects to your android phone and lets you adress 48 i/o ports. It can be connected through an USB cable or by Bluetooth. We decided to use is as an glorified bluetooth module.
The STM32L will talk with the board through UART just like it would with a normal bluetooth module. The phone however can now also talk in UART. Without the board you have to setup the bluetooth streams wich can be a hassle so this simplified it a lot. The communication between the phone and the STM32l is simply UART and the whole bluetooth handling is handled by the IOIO board.
Android App: The app shows wether there is connection with the IOIO board. Also there is a little LED on the IOIO board wich can be turned on and off with a toggle button.
For the actual project there are three input boxes for the colors red, green and blue. The colors can be expanded to a lot =p but that wasn't the focus so we didn't incorperate that.
There is also another input box, this is for the lightthreshold for the photodiode. This way we can change the threshold in different ambient light situations. When the send button is pressed all these values are transported to the STM32l wich, in his turn, will send the received data back. The STM32L will then commence the ball dropping as shown in the video above.