To start with; I'm totally new to Arduino and this kind of programming. I do how ever posses quite good programming skills.
My project is actually kind of simple; I want 5 proximity sensors (infrared or ultra sound is not decided yet) and 5 RGB leds to glow depending on it's proximity sensor. If the sensor is out of range the led is of, when a sensor detects something (~ 4-5 meters) i want the LED to start glow green. When something is coming closer (~2 meters?) to this sensor i want the LED to glow yellow and when it's ~ one meter or under i want the LED to be red. You get the idea.
I do not yet even posses a Arduino, but I'm playing around in Fritzing and I also look at the examples provided here. Since one RGB LED needs three output pins(?) I can't connect all five LEDs directly to my Arduino board, it seems like I have to make a output to some kind of other board which sets the color for the depending LED? Any ideas how to do this?
Has anyone made a similar project before and happen to have an Fritzing saved, or if anyone has any ideas and/or is willing to make an example i would really appreciate it.
In version 2, when I'm starting to get the hang of this, I would also like to have a potentiometer for each sensor to set it's sensibility.
Any help, link, or tips for my project are really appreciated!
First thing to do is determine the kind of sensor that can detect at this distance.
Another issue is how to keep one sensor from interfering with the others. How do you plan to accomplish that?
There are multiplexers that can extend the number of pins. There are techniques for software PWM. These two will take care of the limited number of PWM pins.
On the other hand, you don't need PWM to make a RGB LED light up red, green or blue, so if you could change your color requirements, life would be easier.
Thanks for reply. I'm thinking of using the HC-SR04 ("Ultrasonic distance sensor"), it starts from 4 to 4,5 meters the specs says. The sensors will be placed on some kind of half circle pointing outwards, so they would not interfere, I think?
PaulS:
On the other hand, you don't need PWM to make a RGB LED light up red, green or blue, so if you could change your color requirements, life would be easier.
You mean it can be accomplished if the yellow light is replaced with blue? How do i do that? On the LED, there is one GND-pin and one each for RGB, these must still be connected to something..?
The LEDs will be distanced from the arduino board and the sensors (with some kind of cable, 2-3 meters maybe), so i guess the best thing would be to have some kind of intelligence on the LED side. That is, from the arduino just send 5 signals (one for each led, and then of course a GND, so 6 then totally, so maybe a standard ethernet calbe will do?) and then display the right color depending on the signal in this cable. Then I don't have to use so many leaders in the cable. I think?
You mean it can be accomplished if the yellow light is replaced with blue? How do i do that? On the LED, there is one GND-pin and one each for RGB, these must still be connected to something..?
Unless you need to control the brightness of the Red, Green, or Blue component of the RGB LED, just connect the three legs to any available digital (or analog used as digital) pins.
On the other hand, I just found the NeoPixel 8 led ramp (in action here: - YouTube). This is brilliant for my project, even tho I have to adress the leds a litte different or let 3 of them be silent. I think the case is closed then...
I was just about to recommend NeoPixels. You can buy individual NeoPixels and daisy chain them together. They only need a single digital I/O pin to control. You can set the color / brightness of each pixel individually using Adafruit's library.