Help required with RGB signals

Thread Starter

jay4708

Joined Jul 28, 2014
12
The “If all you have is a hammer...” reference made me think of something.

Arduino C has a function that measures the width of a pulse with one statement. if you connect three pins to the LED leads, you can continuously monitor the LED state. Within a certain error range, you can build a map of the three pulse lengths to a specific situation.

Take a look at the pulsein() command.

An easy sketch could be written to “learn” what conditions each set of LED signals corresponds to.

The application is straightforward enough so that even an Arduino Nano would suffice.
Thank you, I like this, when I get home this evening I will be looking into this further. If you have anything else with regards this idea you could send me it will be much appreciated.

Cheers
Jay
 

ericgibbs

Joined Jan 29, 2010
18,848
hi jay,
If a member posts a Arduino program, I have a range of RGB LED's, I will be able to help build/debug as required.
Where are you located.?
E
 

LesJones

Joined Jan 8, 2017
4,190
Some more thoughts. I don't see that it is necessary to look at precise ratios of primary colours for the TS's situation. For all three situations red is on for 56 uS (Call this 100 %) For amber green is on for 13 uS (23%). For yellow green is on for 41 uS (73%)
If we use the window detector method then if red is on then one of the three warning conditions is present. So if green is less than say 15% then we have a RED output condition. If green is between 15% and say 65% we have an AMBER condition. If it is above 65% we have a YELLOW condition. The same logic would apply to using time measurement of the green signal.
I think a better way may be to use the trigger signal which I assume will be a push button for the patient and a keyswitch or code entered into a keypad for members of staff. A block diagram of the full system may help with a better solution. Is it organised as an individual system for each room or a centralised system covering a number of rooms ? Will the microcontroller have to generate the output tones or just give three on/off outputs ?

Les.
 
Last edited:

djsfantasi

Joined Apr 11, 2010
9,163
Some more thoughts. I don't see that it is necessary to look at precise ratios of primary colours for the TS's situation. For all three situations red is on for 56 uS (Call this 100 %) For amber green is on for 13 uS (23%). For yellow green is on for 41 uS (73%)
If we use the window detector method then if red is on then one of the three warning conditions is present. So if green is less than say 15% then we have a RED output condition. If green is between 15% and say 65% we have an AMBER condition. If it is above 65% we have a YELLOW condition. The same logic would apply to using time measurement of the green signal.

In post #19, I specify “within a certain error range”. This implies a window detection method. To determine the values for each state, I’d write a short measurement sketch. In this way, one can determine the specific pulse times for each color, which can be used for making a table for each state.

The table can then be used to develop your comparison windows.

Here is a sample program
C:
#define RED_PIN A0
#define GREEN_PIN A1
#define INTERRUPT_PIN 2
#define notButtonPressed !buttonPressed
boolean buttonPressed=


void  setup() {

Serial.begin(9600);

pinmode(RED_PIN,INPUT);

pinmode(GREEN_PIN,INPUT);



pinMode(INTERRUPT_PIN, INPUT_PULLUP);

attachInterrupt(digitalPinToInterrupt(INTERRUPT_PIN), check_pin, LOW);
}


void check_pin() {

    buttonPressed=True

    } // end check_pin ISR


void main() {

while(notButtonPressed) {
    while(buttonPressed) {
       int redPulse = pulseIn(RED_PIN, HIGH, 100);

        int greenPulse = pulseIn(GREEN_PIN,  HIGH, 100);

        Serial.print(redPulse);

        Serial.print(“,  “);

        Serial.println(greenPulse);



        ButtonPressed=False;

        } // end buttonPressed

    } // end not buttonPressed

} // end main()
The sketch reads the red and green pins pulse width and prints them on the serial console. It hasn’t been compiled, so there may be errors.
 

LesJones

Joined Jan 8, 2017
4,190
Hi djsfantasi,
I was thinking a slightly different approach. I was thinking of using a PIC (Probably a PIC12F1840.) I was planning on using timer 1 in capture mode as follows. Use the rising edge of the red channel to zero timer 1 and start it counting. Then wait for the falling edge of the green channel to trigger a capture of the value in timer 1. For the amber an yellow conditions the capture register would contain a value corresponding to the time the green channel was high. For the red condition the green channel would not go high so there would be no falling edge to trigger the capture so the capture register would be zero. (It would have been set to zero at the start of the cycle.)

Les.
 

MisterBill2

Joined Jan 23, 2018
18,502
Hello,

I'm after a little help with a project I'm working on please.

I have a nurse call system for an hospital ward that has rgbw LEDs for the lights outside the rooms.

I've been asked if I can find a way to take a signal from the over door lights for each different colour that it displays.

There are three different conditions that I am interested in, they are:-

Patient call - Steady Amber
Assistant call - Flashing Yellow
Emergency call - Flashing Red

I've attached some scope traces for the red and green pins, there is nothing on the blue and white pins for the above conditions.

What I would like to be able to do is take these signals and input them into a PIC or an Arduino and produce and output for all three call levels, is this possible?

Thank you in advance for any help you can give me.

Thanks
Jay

View attachment 204444View attachment 204445View attachment 204446View attachment 204447View attachment 204448View attachment 204449
The most important first question is what kind of signal do you need to get? One single signal, or three at some voltage that is not stated?. And what will that signal connect to?
For starters, there is probably some sort of interface someplace, and at that point all of the signals that you want are present and accessible.

In addition, systems that include an emergency signal in a hospital are by definition LIFE CRITICAL, meaning that if they fail somebody may die. So if you need to ask the question you are not the one to be working on it. Sorry to be so very blunt, but there are places folks should not get into.
 

LesJones

Joined Jan 8, 2017
4,190
MisterBill2, That is a very good point, I originally thought it was probably a homework question. I would expect a hospital to have an electronics department to deal with a job like this. It is a very poor management that gives a job like this to someone that does not have the knowledge to work out a solution.

Les.
 

MisterBill2

Joined Jan 23, 2018
18,502
Looking at a system approach again, someplace upstream there musty be the three different signals coming from three different switches. At that point it should be reasonable to have three opto-isolators that provide the three separate signals. Next, given that hospitals have multiple patient rooms, quite a few of these systems will exist, and so there would be a whole lot of effort to package and install the little computer board, associated I/O hardware, and the power supply, all in a suitable package, in an adequate position for each room.

What is not mentioned is if there is a need for separate tone generators for each room, or just one master device?
One very simple option is a simple diode "OR" gate so that the input to any color drives a transistor, probably a small power FET, to drive a sonalert-type device. Such a small package would at most require only one more wire for power, and so it could al be included in the display package.

But really, there should be information about the announciator system in the hospital maintenance department files. There is quite probably already a signal available. OR, this may be a small, private, understaffed organization.
 

Thread Starter

jay4708

Joined Jul 28, 2014
12
MisterBill2, That is a very good point, I originally thought it was probably a homework question. I would expect a hospital to have an electronics department to deal with a job like this. It is a very poor management that gives a job like this to someone that does not have the knowledge to work out a solution.

Les.
Hi Les,

You are totally correct and I know how critical a nurse call system is within an hospital as I've been installing and servicing them for 30 years.

This job will not see the light of day, yes I've been asked if it's possible but my insurance only covers me for working with products I buy from manufacturers not anything I've made myself. I just wanted to give it a go in my workshop just for my peace of mind and to learn a bit.

Anyway thank you all for the input it's much appreciated.

Jay
 

MisterBill2

Joined Jan 23, 2018
18,502
Hi Les,

You are totally correct and I know how critical a nurse call system is within an hospital as I've been installing and servicing them for 30 years.

This job will not see the light of day, yes I've been asked if it's possible but my insurance only covers me for working with products I buy from manufacturers not anything I've made myself. I just wanted to give it a go in my workshop just for my peace of mind and to learn a bit.

Anyway thank you all for the input it's much appreciated.

Jay
The TS is totally correct about the insurance and the liability issues. That is why I don't service aircraft stuff. Fixing things is one part but then some dummy does something really stupid with it and the lawyer goes after whoever is least able to defend themselves. And that is why some folks get a very non-descript invoice and have to pay cash. And a few just get a verbal "invoice". Of course the other side of the problem is those who represent that they are experts when in reality they are totally clueless.
With this thread it is not clear to me if the call panel used just one multi-color LED or a bunch of different ones. If there are different ones then it becomes simple. And now an interesting concept, which is using photo-transistors to watch the LED display, totally not connected except by some fiber optic threads. Completely non-invasive and unable to cause any failure.
But the fact is that such a system really must have an interface box and the logic for audible signals must be present inside that box.
 
Top