Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.
Photo

Christmas Lights


  • Please log in to reply
22 replies to this topic

#1 c#Geek

c#Geek

    New Member

  • Members
  • Pip
  • 3 posts

Posted 03 November 2012 - 07:54 PM

Hi All,

I'm brand new to the netduino plus world and I have a question. Can I use the netduino plus board to drive this relay board: Relay board

It states that it needs "15-20mA Driver Current" and I'm not sure if the netduino plus board will drive that. I see that it does output 3.3 volts, but I do not see the amps listed anywhere.

You can see some of the light shows I have done in the past with up to 8 channels listed below. I want to use neduino to give me more channels to play with. Now I just need more lights :rolleyes:

Charlie Brown
Two House are better than one
2011 Show My favorite is dueling Jingle bells at 2:34

Thanks in advance for any advice.

Don

#2 JerseyTechGuy

JerseyTechGuy

    Advanced Member

  • Members
  • PipPipPip
  • 870 posts

Posted 03 November 2012 - 09:53 PM

I believe the Digital Pins are 16ma so you should be fine.

#3 Paul Newton

Paul Newton

    Advanced Member

  • Members
  • PipPipPip
  • 724 posts
  • LocationBerkshire, UK

Posted 03 November 2012 - 10:11 PM

Hi Don,

Welcome to the Forums!

Unfortunately, only three of the digital IOs can drive the maximum 16mA of output current.
The others are just 8mA.
See this Wiki page.

I would recommend using some 74HC595 chips to drive the relay card inputs. These are easily connected to the Netduino via SPI.

Hope this helps - Paul

#4 c#Geek

c#Geek

    New Member

  • Members
  • Pip
  • 3 posts

Posted 03 November 2012 - 11:26 PM

Thanks for the information and advice Paul. I am a hardware newbie (been coding in C# since 2001) and I'm not sure how the 74HC595 chips work. Is there a newbie guide or a 101 page? Thanks! Don

#5 Thomas Mason

Thomas Mason

    Member

  • Members
  • PipPip
  • 26 posts

Posted 04 November 2012 - 12:23 AM

Thanks for the information and advice Paul. I am a hardware newbie (been coding in C# since 2001) and I'm not sure how the 74HC595 chips work. Is there a newbie guide or a 101 page?

Thanks!

Don


How funny apearently you and I are working on the same project because i currently have thread open on this same subject. Here is a good link on the shift register. I dont mind just merging our two threads here so we can both get any answers without asking people to answer both of us.

How are you planning to send the data to the netduino ? I am trying to use serial as I do not have a plus. Also how are you making the sequence there is some good code here but it will need some adjusting as it is for a phidget board :( but I a have made some changes to make that happen already (realy just commented out the phidget part).

At any rate let me know if I can help with your project at all.

#6 Thomas Mason

Thomas Mason

    Member

  • Members
  • PipPip
  • 26 posts

Posted 04 November 2012 - 01:08 AM

Hi All,

I'm brand new to the netduino plus world and I have a question. Can I use the netduino plus board to drive this relay board: Relay board

It states that it needs "15-20mA Driver Current" and I'm not sure if the netduino plus board will drive that. I see that it does output 3.3 volts, but I do not see the amps listed anywhere.

You can see some of the light shows I have done in the past with up to 8 channels listed below. I want to use neduino to give me more channels to play with. Now I just need more lights :rolleyes:

Charlie Brown
Two House are better than one
2011 Show My favorite is dueling Jingle bells at 2:34

Thanks in advance for any advice.

Don


I am not sure that the driver current it is talking about would come from the netduino ... they are 12v relays and there is a 12v input port on the unit. It almost seems like the unit has 12v relays that are switched by transitors on the board that are switched by the netduino. Any ways that is my take on it. I am trying to find more info on this board myself.

#7 c#Geek

c#Geek

    New Member

  • Members
  • Pip
  • 3 posts

Posted 04 November 2012 - 01:22 AM

How funny apearently you and I are working on the same project because i currently have thread open on this same subject. Here is a good link on the shift register. I dont mind just merging our two threads here so we can both get any answers without asking people to answer both of us.

How are you planning to send the data to the netduino ? I am trying to use serial as I do not have a plus. Also how are you making the sequence there is some good code here but it will need some adjusting as it is for a phidget board :( but I a have made some changes to make that happen already (realy just commented out the phidget part).

At any rate let me know if I can help with your project at all.



That is the code I was using on the youtube video. I can send you my sequence files if you would like. I will put a post together in the next few days that has the sequence file and the link to the MP3 files I used. Do you have any to share?

The phidget relays are nice and easy to use but very costly as you try to increase the amount of channels. The code from Brian Peek should work just fine, I planned on changing the call to the phidget relay, he already has it classed out, so it should be an easy change.

I planned on using the netduino plus as a web server and running the sequence file from there. That is how I did the two houses. I run all the sound from my main PC and kick off the second house via a web service.

All you need on your end is a trigger to start the sequnce file.

It does not look like much on the video but is realy cool when you see it live. I just ordered an FM transmitter for this years show. My neighbors will enjoy that. B)

How have you gone about making your sequence files? I have found that if I take the sequnce files and break them into 1/10th of a second then its easy to cross match the time in Audacity.

I looked over that diagram and it appears that for every 3 control wires you can control 8 leds(relays in our case). So it seems we could control 48 relays with one netduino. WOW! That would be much cheaper.

ok, I'm gonna end my ramblings for now. Its awesome to see we are in the same boat. I'll dig up those files and get them out in the next few days. I have a newborn in the house (Hooray! :P ) but I just don't have as much freetime now.

Don

#8 Thomas Mason

Thomas Mason

    Member

  • Members
  • PipPip
  • 26 posts

Posted 04 November 2012 - 01:38 AM

That is the code I was using on the youtube video. I can send you my sequence files if you would like. I will put a post together in the next few days that has the sequence file and the link to the MP3 files I used. Do you have any to share?

The phidget relays are nice and easy to use but very costly as you try to increase the amount of channels. The code from Brian Peek should work just fine, I planned on changing the call to the phidget relay, he already has it classed out, so it should be an easy change.

I planned on using the netduino plus as a web server and running the sequence file from there. That is how I did the two houses. I run all the sound from my main PC and kick off the second house via a web service.

All you need on your end is a trigger to start the sequnce file.

It does not look like much on the video but is realy cool when you see it live. I just ordered an FM transmitter for this years show. My neighbors will enjoy that. B)

How have you gone about making your sequence files? I have found that if I take the sequnce files and break them into 1/10th of a second then its easy to cross match the time in Audacity.

I looked over that diagram and it appears that for every 3 control wires you can control 8 leds(relays in our case). So it seems we could control 48 relays with one netduino. WOW! That would be much cheaper.

ok, I'm gonna end my ramblings for now. Its awesome to see we are in the same boat. I'll dig up those files and get them out in the next few days. I have a newborn in the house (Hooray! :P ) but I just don't have as much freetime now.

Don


well actually since you can cascade the shift registers you can control numerous outputs per every three pins. Basically you just loop through sending bits to the register and once it has filled up (8 bits) it can over flow the others to another and so on and so one .. So in my case I am looking at 4 shift registers using three pins and then i just loop for a 32 count and latch .. and viola.

So are you not using brians app to make the sequences?

what we are doing is we are going to set this up on a tree/light display in the break room at our office and then allow the employees to make sequences using brians app via some pcs in the breakroom. The we will load them to the display at regualr intervals. we also plan on mmaking a sharepoint web part to show the upcoming show and who made it. It should be a really fun project. The netduino and the shift register will deff let you use more lights which is always better right.

Congrats on the newborn I have a 6months and three year old myself so I understand.

#9 Paul Newton

Paul Newton

    Advanced Member

  • Members
  • PipPipPip
  • 724 posts
  • LocationBerkshire, UK

Posted 04 November 2012 - 10:43 AM

Good to see you found each other!

well actually since you can cascade the shift registers you can control numerous outputs per every three pins. Basically you just loop through sending bits to the register and once it has filled up (8 bits) it can over flow the others to another and so on and so one .. So in my case I am looking at 4 shift registers using three pins and then i just loop for a 32 count and latch .. and viola.

Exactly. Just daisy chain the shift registers onto the single SPI of the Netduino, then write out an array of bytes - one per shift register.

(If you wanted to control them separately, you can also share the SPI clock and data out lines, but use a different strobe line for each shift register so that only one register updates at a time.)

I am not sure that the driver current it is talking about would come from the netduino ... they are 12v relays and there is a 12v input port on the unit. It almost seems like the unit has 12v relays that are switched by transitors on the board that are switched by the netduino. Any ways that is my take on it. I am trying to find more info on this board myself.

The relay board provides the current to drive the relay coils using a transistor, so the Netduino does not have to (it can't drive enough current for a relay coil).
The 15-20mA figure is for the current that is needed to turn on each LED in the opto-isolator that drives the tranistors. This current does have to pass through a switching device outside the relay board - e.g. from a shift register chip or an external transistor circuit.

On this page there is a link to a diagram of the relay board's input. It is for a two channel version, I am assuming its the same circuit for the relay card you both found. I can't find a full schematic for the relay board that is large enough to see.
Posted Image

From this diagram it appears that the relay board needs each control input to be connected to ground to turn on each opto-isolator's LED. So the 15-20mA current actually flows out of the relay board - not into it. (The Netduino still can't handle this.)

Paul

#10 Thomas Mason

Thomas Mason

    Member

  • Members
  • PipPip
  • 26 posts

Posted 04 November 2012 - 07:19 PM

Hi All,

I'm brand new to the netduino plus world and I have a question. Can I use the netduino plus board to drive this relay board: Relay board

It states that it needs "15-20mA Driver Current" and I'm not sure if the netduino plus board will drive that. I see that it does output 3.3 volts, but I do not see the amps listed anywhere.

You can see some of the light shows I have done in the past with up to 8 channels listed below. I want to use neduino to give me more channels to play with. Now I just need more lights :rolleyes:

Charlie Brown
Two House are better than one
2011 Show My favorite is dueling Jingle bells at 2:34

Thanks in advance for any advice.

Don



This might make things easier.

http://netmftoolbox....ailable classes

#11 Thomas Mason

Thomas Mason

    Member

  • Members
  • PipPip
  • 26 posts

Posted 20 November 2012 - 02:05 AM

Good to see you found each other!


Exactly. Just daisy chain the shift registers onto the single SPI of the Netduino, then write out an array of bytes - one per shift register.

(If you wanted to control them separately, you can also share the SPI clock and data out lines, but use a different strobe line for each shift register so that only one register updates at a time.)


The relay board provides the current to drive the relay coils using a transistor, so the Netduino does not have to (it can't drive enough current for a relay coil).
The 15-20mA figure is for the current that is needed to turn on each LED in the opto-isolator that drives the tranistors. This current does have to pass through a switching device outside the relay board - e.g. from a shift register chip or an external transistor circuit.

On this page there is a link to a diagram of the relay board's input. It is for a two channel version, I am assuming its the same circuit for the relay card you both found. I can't find a full schematic for the relay board that is large enough to see.
Posted Image

From this diagram it appears that the relay board needs each control input to be connected to ground to turn on each opto-isolator's LED. So the 15-20mA current actually flows out of the relay board - not into it. (The Netduino still can't handle this.)

Paul


we have all of our equipment in now and I want to let you know how I have it wired thus far to see if "looks" right. Basically we have two 16 channel relay board (the ones from before) and 4 74HC595. The 74HC595 are wired to the netduino and are powered from the netduino. The outputs of the 74HC595 go to the realy board to control the unit. Will this work or should i get the power for the 74HC595 from somwhere else.

#12 Paul Newton

Paul Newton

    Advanced Member

  • Members
  • PipPipPip
  • 724 posts
  • LocationBerkshire, UK

Posted 20 November 2012 - 06:48 AM

Hi again, That should be OK as long as the grounds are joined. The current to turn on the relays will flow out of the relay board, into the 74HC595, down to ground and then return to the relay board's ground. Paul

#13 Thomas Mason

Thomas Mason

    Member

  • Members
  • PipPip
  • 26 posts

Posted 21 November 2012 - 04:45 PM

Hi again,
That should be OK as long as the grounds are joined.
The current to turn on the relays will flow out of the relay board, into the 74HC595, down to ground and then return to the relay board's ground.
Paul

I guess there is still somthing I dont understand. Basically the outputs of the 74HC595 are sending voltage out, but they need to be connecting relay to ground . Do in need a transistor here or something. In other words how is the 74HC595 going to complete the circuit? I guess I still dont understand exactly what the 74HC595 is doing. Is it just working as a switch and/or relay in other words. So can i use it to complete the ground circuit of the relay? Does the 74HC595 have to have the 5v in order to operate or is that just if you want to send power out rather than connecting a ground like i need ?

#14 Paul Newton

Paul Newton

    Advanced Member

  • Members
  • PipPipPip
  • 724 posts
  • LocationBerkshire, UK

Posted 21 November 2012 - 06:57 PM

Hi Thomas,

Inside the 74HC595 there are two transistors connected to each output pin. Only one is turned on at a time.
One connects the pin to Vcc (+5V or +3.3V), the other connects the pin to ground (0V).

If you load the 74HC595 with a data byte that has zero for your chosen output pin, the "to ground" transistor is turned ON.
If you load the 74HC595 with a data byte that has one for your chosen output pin, the "to Vcc" transistor is turned ON.

This means that whilst you can think of the output pin "sending voltage out", the output pin is actually sourcing or sinking current.
For example, you could connect an LED (and resistor) between the output and ground; the LED would come on when the output is set to one.
Or, you could connect an LED (and resistor) between the output and Vcc; the LED would come on when the output is set to zero.

The second case is what you would use with the relay board.
The 74HC595 could take its Vcc from either the power supply on the relay board or the power supply on the Netduino. Since the LED current is flowing to ground, the Vcc of the 74HC595 is not going to take lots of current - so you don't need to worry about taking too much current if you chose to take Vcc from the Netduino.
Wherever you chose to take Vcc from, make sure that all the grounds are joined up so the LED current and Netduino output pin current can return to where it came from.

One more feature of the 74HC595 is that it also has an output enable pin.
When the notOE pin is low, one of the above transistors will be ON.
When the notOE pin is high, both of the transistors will be OFF. This makes the pin "tri-state". When it is tri-state, current can't flow in or out.
Recall that the Netduino family have that sometimes annoying feature of pulling all the pins high at power on; well in this case, if you connect the notOE pin to a spare Netduino pin, it will cause all the 74HC595 outputs to be tri-state when the Netduino resets/powers up, allowing you to load a data byte into the 74HC595 before any of the IO pins becomes capable of energising a relay.

I hope that all a bit clearer now.

Paul

#15 Thomas Mason

Thomas Mason

    Member

  • Members
  • PipPip
  • 26 posts

Posted 21 November 2012 - 07:45 PM

Hi Thomas,

Inside the 74HC595 there are two transistors connected to each output pin. Only one is turned on at a time.
One connects the pin to Vcc (+5V or +3.3V), the other connects the pin to ground (0V).

If you load the 74HC595 with a data byte that has zero for your chosen output pin, the "to ground" transistor is turned ON.
If you load the 74HC595 with a data byte that has one for your chosen output pin, the "to Vcc" transistor is turned ON.

This means that whilst you can think of the output pin "sending voltage out", the output pin is actually sourcing or sinking current.
For example, you could connect an LED (and resistor) between the output and ground; the LED would come on when the output is set to one.
Or, you could connect an LED (and resistor) between the output and Vcc; the LED would come on when the output is set to zero.

The second case is what you would use with the relay board.
The 74HC595 could take its Vcc from either the power supply on the relay board or the power supply on the Netduino. Since the LED current is flowing to ground, the Vcc of the 74HC595 is not going to take lots of current - so you don't need to worry about taking too much current if you chose to take Vcc from the Netduino.
Wherever you chose to take Vcc from, make sure that all the grounds are joined up so the LED current and Netduino output pin current can return to where it came from.

One more feature of the 74HC595 is that it also has an output enable pin.
When the notOE pin is low, one of the above transistors will be ON.
When the notOE pin is high, both of the transistors will be OFF. This makes the pin "tri-state". When it is tri-state, current can't flow in or out.
Recall that the Netduino family have that sometimes annoying feature of pulling all the pins high at power on; well in this case, if you connect the notOE pin to a spare Netduino pin, it will cause all the 74HC595 outputs to be tri-state when the Netduino resets/powers up, allowing you to load a data byte into the 74HC595 before any of the IO pins becomes capable of energising a relay.

I hope that all a bit clearer now.

Paul

Thanks that explains a lot better but it still does not work right. The realy board works fine when I cannot direct to a digital output of the netduino (although I cannot make it go off by just write(false) I acutally have to dispose the pin ) but when I connect to the shift register the relay just stays on and never goes off even though i send low. I am using this code
int delayTime = 1000;
            bool state = false;
            while (true)
            {
                latch.Write(false);

                for (int i = 0; i < 8; i++)
                {
                    state = !state;
                    data.Write(state);

                    clock.Write(true);
                    //Thread.Sleep(1);
                    clock.Write(false);
                }
                latch.Write(true);
                Thread.Sleep(delayTime);
            }
but the relays never go off they just stay on. If I set the OE to high they go off but not otherwise. Also if I leave OE at high they can flash but not at all like they should.

I really wonder if in all my tinkering i have burned up the shift registers.

#16 Paul Newton

Paul Newton

    Advanced Member

  • Members
  • PipPipPip
  • 724 posts
  • LocationBerkshire, UK

Posted 21 November 2012 - 08:16 PM

Can you post a circuit diagram showing the connections to the Netduino and what you are doing with the other pins?

#17 Paul Newton

Paul Newton

    Advanced Member

  • Members
  • PipPipPip
  • 724 posts
  • LocationBerkshire, UK

Posted 21 November 2012 - 08:22 PM

Thanks that explains a lot better but it still does not work right. The realy board works fine when I cannot direct to a digital output of the netduino (although I cannot make it go off by just write(false) I acutally have to dispose the pin ) but when I connect to the shift register the relay just stays on and never goes off even though i send low. I am using this code

int delayTime = 1000;
            bool state = false;
            while (true)
            {
                latch.Write(false);

                for (int i = 0; i < 8; i++)
                {
                    state = !state;
                    data.Write(state);

                    clock.Write(true);
                    //Thread.Sleep(1);
                    clock.Write(false);
                }
                latch.Write(true);
                Thread.Sleep(delayTime);
            }
but the relays never go off they just stay on. If I set the OE to high they go off but not otherwise. Also if I leave OE at high they can flash but not at all like they should.

I really wonder if in all my tinkering i have burned up the shift registers.


Try adding another
state = !state;
after the
Thread.Sleep(delayTime);

That will invert the sequence you are sending out each time you write a new byte.
e.g. first byte = 10101010
next byte = 01010101
and so on.

I think your current code will send 10101010 every time, so the outputs on the shift register will settle on a pattern and stick with it.

Paul

#18 Thomas Mason

Thomas Mason

    Member

  • Members
  • PipPip
  • 26 posts

Posted 21 November 2012 - 09:45 PM

Ok paul so that was dumb on my part I did not rewrite it correctly when making the test app. It is working now but it still seems that it is wrong some how. I have 5v coming from the netduino going to the my shift register then the ground is going to the ground on the relay board. I would think I could take all the power from the relay baord but this config just causes the lights to be always on. At any rate it does work but I just hope I am not overlaoding anything. By the way I have to say much respect to netduino today, I have hooked this up every which of way many of which are clearly wrong, and all apears to to still be working

#19 Paul Newton

Paul Newton

    Advanced Member

  • Members
  • PipPipPip
  • 724 posts
  • LocationBerkshire, UK

Posted 21 November 2012 - 10:49 PM

Yes, I think you should be able to power the Netuino from the relay board. Not sure why it would not be working. Can you draw what you have?

#20 RCrouch

RCrouch

    New Member

  • Members
  • Pip
  • 1 posts

Posted 23 November 2012 - 04:04 PM

That is the code I was using on the youtube video. I can send you my sequence files if you would like. I will put a post together in the next few days that has the sequence file and the link to the MP3 files I used. Do you have any to share?

The phidget relays are nice and easy to use but very costly as you try to increase the amount of channels. The code from Brian Peek should work just fine, I planned on changing the call to the phidget relay, he already has it classed out, so it should be an easy change.

I planned on using the netduino plus as a web server and running the sequence file from there. That is how I did the two houses. I run all the sound from my main PC and kick off the second house via a web service.

All you need on your end is a trigger to start the sequnce file.

It does not look like much on the video but is realy cool when you see it live. I just ordered an FM transmitter for this years show. My neighbors will enjoy that. B)

How have you gone about making your sequence files? I have found that if I take the sequnce files and break them into 1/10th of a second then its easy to cross match the time in Audacity.

I looked over that diagram and it appears that for every 3 control wires you can control 8 leds(relays in our case). So it seems we could control 48 relays with one netduino. WOW! That would be much cheaper.

ok, I'm gonna end my ramblings for now. Its awesome to see we are in the same boat. I'll dig up those files and get them out in the next few days. I have a newborn in the house (Hooray! :P ) but I just don't have as much freetime now.

Don


I am also working on the same project. Do you have any of the code available (i.e. NetDuino or Brian's code w/o references to the phidget relay). I am looking to create the sequence files on my PC with Brian's code, but store and execute them on the NetDuino.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.