Go Down

Topic: Arduino/PLC/RGB strips (Read 1 time) previous topic - next topic

Myillusionart

Hello,

I thought about a new project setting up an Arduino Uno R3 "communicating" with an PLC. the goal is that the arduino controlls the LED RGB strips. Therefore I want to have 6 Inputs for 6 individuall programmed Light actions.

Input 1 - only Yellow blinking at 2 Hz
...
Input 6 - running light, green at 1 Hz

The signal to choose the light actions comes from the PLC. My question is if this is all possible. I know that its possible to drive the LED strips but whats with the arduino gets the commands from the PLC (its just high or low signal). How would you programm it ?

Would be nice if you can help me handle that project!

Thx in advance for your answeres.

Best regards Mike

Myillusionart

Hey,

I have a question about programm control with Arduino. I´d like to use 6 digital inputs to control programm features. It´s used with an RGB strip.


Like:

Input 1: only Yellow
Input 2: only Red, blinking
Input 3: only Yellow with running light
...
Input 6: Green running light

The question is if this kind of program control is possible with the Arduino. Doesn´t matter which kind of Arduino I just search for a microcontroller which can handle with my Idea. Hope you can help me.

Thx in advance !

Steen

yes, this is perfectly possible. The only thing you have to keep in mind is the number of pins you have. If you do not use driver chips (so you have to wire up every led yourself through multiplexing) the it might get hard, but if you use a such a chip, it can be easely done.

Nick Gammon

Threads merged. Don't just create a new thread asking the same question please. Be patient and someone will answer you.

Quote
The question is if this kind of program control is possible  ...


Most things are possible. Perhaps you can ask a more specific question? Preferably one that shows you used Google or similar to do some research of your own.
http://www.gammon.com.au/electronics

Myillusionart

#4
Apr 24, 2012, 07:46 am Last Edit: Apr 24, 2012, 07:50 am by Myillusionart Reason: 1

yes, this is perfectly possible. The only thing you have to keep in mind is the number of pins you have. If you do not use driver chips (so you have to wire up every led yourself through multiplexing) the it might get hard, but if you use a such a chip, it can be easely done.


Hey, thanks for fast reply.

Further question. I use LED RGB strips as you can see in the link below. So the wiring effort is not the problem. Is it possible that you give me a short (really short) overview of the code needed to do this "programm control". The problem is all my contacted suppliers for RGB LED strips say that it is not possible to set up an Arduino lik eI want. I think like you do "it can be done". Confusing thing.

// Edit:

Sorry Nick for double posting, wont happen again. I search for about 1 Week to fix that problem. Try tu use the keywords on google "Arduino and PLC" you will get only none specific answeres.



http://gng.en.alibaba.com/product/554055040-200140982/full_color_smd_flexible_digital_lpd8806_rgb_led_strip.html

CrossRoads

#5
Apr 24, 2012, 07:50 am Last Edit: Apr 24, 2012, 07:52 am by CrossRoads Reason: 1
That  particular strip seems to have an embedded IC in it
drive IC: LPD8806
that receives commands and controls the LEDs.
You will need code to send messages to the chip.

Here's a good starting point:
http://www.ladyada.net/products/digitalrgbledstrip/index.html
Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Nick Gammon


I use LED RGB strips as you can see in the link below.


Good idea to post the link. Just a tip ... you get a more detailed answer if you give more details in the question. Now we can see the link we can come up with helpful answers.

As an example:

https://github.com/adafruit/LPD8806

There: Arduino library for LED strips and pixels using LPD8806
http://www.gammon.com.au/electronics

Myillusionart

Thx a lot to both of you!

Just to make sure i understand you right. Please have a look at my little "programm think sketch"  for the upcoming code using arduino PLC and the RGB LED strips. The inputPin1-6 get +5V from the PLC.

Code: [Select]


void setup ()
{

// setting up all the pins and functions i use e.g. pinMode

}

void loop ()
{

if (inputPin 1 == high)
{
doThingA;

if (inputPin 1 == low)
{
jumpBack to main loop;
}
}
else if (inputPin 2 == high)
{
doThingB;

if (inputPin 2 == low)
{
jumpBack to main loop;
}

// (...) continuing pin 3,4,5, 6

else
{
doThingG;
}

}




CrossRoads

You don't need these
   if (inputPin 1 == low)
   {
      jumpBack to main loop;
   }
If it fails the High condition, the sketch will just continue & read the next sketch.

Also, you need to read the pin:

if (digitalRead(input1pin) == LOW) { ...}
if (digitalRead(input2pin) == LOW) { ...}
if (digitalRead(input3pin) == LOW) { ...}
if (digitalRead(input4pin) == LOW) { ...}
if (digitalRead(input5pin) == LOW) { ...}
if (digitalRead(input6pin) == LOW) { ...}
use the internal pullups, and have your switch ground the pin to make the condition active.
Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Myillusionart

Hey,

thanks a lot!

I have another question, is there a possibility to calculate the time out of the used code ?  The change of the RGB strip colors should go as fast as possible.

CrossRoads

Sure - but the outputs will change within microseconds of the button pushes.

use this:
unsigned long startTime = micros();

and then
unsigned long endTime = micros();

and do the math
unsigned long elapsedTime = endTime - startTime; // in microseconds
Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Go Up