Monday, December 9, 2013

Pictures of our Progress

Soooo we've got things agoing. It's been decided for a while now, but we hadn't expressed what we chose for our project. It was Idea 2. With the baseplate cut and the film having arrived, we are on a roll to getting this thing done! I'm going to explain how the original plan was supposed to work. We would acquire three different films corresponding to each of the three primary colors of the rainbow, red, yellow, and blue. Each of these three films would be attached to its own servo motor. Now these servos would be arranged in a circular pattern equidistant from each other, and a light in the center of the circle would shine up. This white light would project the color of the film onto a white foreground (paper). Therefore, if we had two colors, say blue and yellow, on top of the light, the colors would mix and on the foreground we would see green.
 
Like so: 
 
Note: I thought everyone was instinctively aware of how the color wheel works, but I was proven wrong on multiple occassions so for those who are doubting themselves right now, here it is:
Primary Secondary Tertiary Colorsin the second graph, the colors in between the primaries are the colors produced when they get mixed. In the third graph the same holds true.


Anyways, the servo would be controlled by three buttons connected to the breadboard. Each button represented a certain color. So pressing a button would activate the servo holding that color to spin and be placed on top of the light so it could be projected on the foreground. The LCD screen would then say what color was being formed by the films. Furthermore, there would be an led that would shine a color reflecting what was displayed on the foreground.

The whole setup for the servo motor and the baseplate remains the same. It looks pretty too.

 
 
The idea is to mount the films onto the spinning part of the servos somehow and that would allow them to turn towards the middle. They are relatively light and flexible so keeping them from sagging is an issue we're still working on.
 

A couple of other plans have been altered though. Instead of using buttons to turn on the leds, we're using potentiometers. This way, there is no need to worry about debouncing functions, we simply set a certain range of the potentiometer as an "on" position, and the rest as an "off". Each potentiometer will act control one primary color so activating it will make that servo turn towards the white light. Originally, we were going to use an RGB led to produce the color, but what we didn't notice was that although the prime colors are red, yellow, and blue, the led does not use this same scheme of coloring(a silly mistake considering that RGB stands for Red Green and Blue). So we have to make this correction. One proposed solution is to get three leds corresponding to the colors of the films. This way when we activate a certain servo, it would simultaneously activate the same colored led. We could encapsulate these three leds in some sort of cloudy enclosure so that the light would mix inside and the only thing visible would be the totality of the mixed colors (unless we only had one color showing, in which case that would be the color visible). We've still got to figure this part out.

Here's Mr. Dave slaving away at code and some wiring. When we turned the red potentiometer on, for some reason the led wouldnt work. The green and blue worked perfectly, and when activated in conjunction produced cyan (wrong colors but it worked like a charm). What was wrong with the red color? Who know.

Tuesday, December 3, 2013

Minimal LCD Wiring

One alternative to using two Arduinos connected in parallel: using the shift register to reduce the number of pins to three. Here is a schematic for the 3-pin LCD Monitor: And here is a picture of someone who apparently gutted their breadboard to do the same thing: I don't have a soldering kit, but I think I'm going to go Radio Shack later today and try and buy some strip board and a couple of other components, and try to make a shield like this. This would definitely make the project easier to package, and if we finished early perhaps we could create a housing or something to make it more like an actual product

Using the Wire Library to Expand the Arduino's I/O Capabilities

The simplest way we've found to make use of the library is outlined in the following hyperlink: Expand IO Ports with Another Arduino Here is a Fritzing diagram of the circuit: This is the best and most straightforward code we have found so far. However, our original plan was to have the "slave" Arduino simply act as a medium for the LCD display. It's not clear what the limitations on the sending/ receiving of bits are. Somewhere on the Arduino website it seems to say that only 6-bytes can be transferred via the Serial port, meaning that the LCD screen would have to be run in 4-bit mode as it is now. While it would de-clutter the breadboard wiring quite a bit, it would complicate the sending and receiving of data. If we outsourced the servo-control to the other Arduino, we would free up some PWM pins- but at the same time it would complicate our subfunctions.

Coding Update

Before receiving parts this upcoming lab session, we put together some prototype code for the device. Rather than use three push-buttons to control the Red, Green, and Blue lights/ films, we decided to try potentiometers. This simplifies the coding in that instead of having an often imperfect debounce function, we have "off" and "on" portions of the potentiometer's range.

Furthermore, if we manage to get the dual-Arduino interface working then we will be able to use the analog-input pins from the potentiometers in conjunction with PWM pins going to the RGB LED. As one or more of the servo-motors rotate the films into the light, we could have the RGB LED fade in or out simultaneously. This would really only bring aesthetic value.

As we have it now, the LCD-screen (running in 4-bit mode due to I/O constraints) uses too many PWM pins for this to be possible- especially because the servo motors require PWM as well.

There are a few features we would like to consider exploring and expanding such as this LED- fader function. We'll talk about these more in the next post.


Here we have the working code. We made heavy use of arrays, because most of the time we were manipulating three variables- one corresponding to red, green and blue. Not only did this simplify and streamline our code, but it allowed us to use for-loops. This cut down on the size of the sketch and will make debugging much easier.

Next, we used multiple "switch" statements. We shied away from if-else statements, because the variables are very well constrained and defined and therefore fit 'cases' rather than conditions. In Java, using 'break' statements is considered sloppy coding, but this simplifies our code enough that it doesn't matter.
Finally, we condensed much of our coding into subfunctions and wrote many of our given values as variables. This de-clutters the main loop, simplifies future adjustments and overall makes the code much more modular. Here is what we have:

Thursday, November 14, 2013

Project Idea 2

Light projection with the use of transparent plastics/film and servo motors

- Three servo motors mounted to a baseplate will have 3 different transparent, colored materials that will turn each material under a light that projects the color onto a white background

- Each motor will be controlled by a button so that the user will be able to control which color is to be displayed

- Code will consist of the servo motor code, the buttonled code and lcd code

Project Idea 1

Button controlled led connected to a DC motor which spins (or drives) an object in a set path.

Using the mapping function, the frequency of a color determines the speed of the motor.

Hello

We are the Pimps from Oakland:

Joshua Harris

Mathews Torres

Dave Birch