Serial port / Project Help
#1
Posted 03 November 2012 - 02:09 AM
I have a group at my work and we are working on a lighting display for our office. we are looking at different ways to control up to 32 channels of 120v lights, that will be synced with some music. For this project I am looking to use a laptop to control the lights via some controller. I have looked at just using usb relay boards, but since I already have a Netduino I want to use it and a relay sheild such as this one because it would be cheaper (plus Netduino is much funner right). My question is basically that I am looking for advice as to what would be the best way to communicate with the Netduino in order to send commands. I need to control 32 channels so I will be using some shift registers to accomplish this but how could I send command to the Netduino. Can I do it via USB or does some one have a better way (this is a standard Netduino not the plus).
If any one has some advice on this ... or any other part of the project I would appreciate it.
To be more specific i have read post such as these speaking of serial ports on the device. The question I have is how do I attach to these IE: can i just use a serial cable or is there something special I should know. I am pretty sure I can handle the .net side I am just worried about the physical hookup.
#2
Posted 03 November 2012 - 05:19 AM
#3
Posted 03 November 2012 - 01:46 PM
Thomas,
Welcome OnBoard
What about using Ethernet? Ethernet is a common in many environments and from my experience, very stable in Netduino Plus. I have some code ready and tested if you need it.
Regards,
Carlos A. Estrada
Thanks for the reply Carlos! However as I said I do not have a plus I just have gen one Netduino, so ethernet is not an option for me.
#4
Posted 03 November 2012 - 09:24 PM
The relay card looks like it needs one GPIO per relay, so you will need to use some logic to control more than one set of 16 lamps.
Using the 74HC595 shift registers is a really easy way to do this - see the Wiki for examples.
You might want to consider using Solid State Relays "SSR"s instead of normal mechanical relays. Mechanical relays will wear out if you are using them to flash lights on and off a lot (e.g. in time to music). They also create electrical noise when they switch which can cause interference to other equipment. SSRs will often include a zero crossing circuit that mean they switch on when the AC voltage passes through zero - this reduces any noise.
Connecting to the PC will be straight forward using a serial port. Assuming you don't have a "state of the ark" PC like mine, you will probably need a USB to serial adapter. Older PCs came with a serial port as standard.
I would always recommend devices from FTDI for USB interfacing, professionally I have found them to be very reliable. They have a set of chips that do the job, and sell cables with bare wire ends to connect to your device. There are two obvious options, USB to RS232 and USB to TTL.
If you go for USB to TTL, you will not need to use any other hardware. (Chose a 3.3V compatible part.) The TX and RX lines just connect to the Netduino's Rx and TX lines.
If you go for USB to RS232, you will also need a level converter at the Netduino. There are plenty of level converters around to chose from. The benefit of using RS232 is that you will be able to use a longer cable, and it would allow other configurations in the future if you move away from the PC with USB design.
(There would be no difference in the software you write.)
Hope this helps - Paul
PS if you use Android - disable the auto update option. Chrome decided to update on me half way through typing this response. I lost the lot and started again using a laptop.
EDIT: Just spotted on the link you gave that the relay card needs 15 to 20mA per input. The Netduino digital IOs have different limits and only three of them can source the maximum 16mA. Hence you will not be able to drive the relay card directly without using either transistors or a device like the 74HC595. See the Wiki page on how much current can be drawn from IO lines.
#5
Posted 04 November 2012 - 12:43 AM
#6
Posted 04 November 2012 - 10:05 AM
Whilst the Netduino is quite limited in the amount of current it can supply on each of its IO pins, the shift register chip's IO pins can drive the current needed for the relay board inputs (in the 74HC595 data sheet, it states up to +/- 35mA).
Just like the Netduino, there is still a limit on total current that can be taken by the chip. I was surprised to see this is 70mA in the data sheet I just read - I have happily been driving 8 LEDs from these chips for some time now without any problems.
Paul
EDIT:
I added a diagram of the two channel relay card input on the other forum page.
The supply current for the LEDs in the opto-isolators appears to come from the relay board, the external circuit provides a path to ground for the LED current. This current to ground is still to high for the Netduino pins to sink directly.
Sorry for any confusion
#7
Posted 04 November 2012 - 01:33 PM
#8
Posted 04 November 2012 - 06:09 PM
#9
Posted 04 November 2012 - 06:51 PM
So my goal is to drive two of these relay boards for a total of 32 channels. I will need to cascade 4 shift registers to get this done. Would you say that I can drive this directly off the netduino ? If not what would my alternative be transistors?
Thomas,
You may want to look at this shield, it is made by a membeer of this forum. Multiplexor shield
I have one that I put together but have not used yet. The price was right.
Chuck
#10
Posted 04 November 2012 - 07:18 PM
Thanks for the reply Chuck that link led me to some good info on hooking up the shift registers as well.Thomas,
You may want to look at this shield, it is made by a membeer of this forum. Multiplexor shield
I have one that I put together but have not used yet. The price was right.
Chuck
#11
Posted 05 November 2012 - 12:38 AM
Hi Thomas,
The relay card looks like it needs one GPIO per relay, so you will need to use some logic to control more than one set of 16 lamps.
Using the 74HC595 shift registers is a really easy way to do this - see the Wiki for examples.
You might want to consider using Solid State Relays "SSR"s instead of normal mechanical relays. Mechanical relays will wear out if you are using them to flash lights on and off a lot (e.g. in time to music). They also create electrical noise when they switch which can cause interference to other equipment. SSRs will often include a zero crossing circuit that mean they switch on when the AC voltage passes through zero - this reduces any noise.
Connecting to the PC will be straight forward using a serial port. Assuming you don't have a "state of the ark" PC like mine, you will probably need a USB to serial adapter. Older PCs came with a serial port as standard.
I would always recommend devices from FTDI for USB interfacing, professionally I have found them to bei very reliable. They have a set of chips that do the job, and sell cables with bare wire ends to connect to your device. There are two obvious options, USB to RS232 and USB to TTL.
If you go for USB to TTL, you will not need to use any other hardware. (Chose a 3.3V compatible part.) The TX and RX lines just connect to the Netduino's Rx and TX lines.
If you go for USB to RS232, you will also need a level converter at the Netduino. There are plenty of level converters around to chose from. The benefit of using RS232 is that you will be able to use a longer cable, and it would allow other configurations in the future if you move away from the PC with USB design.
(There would be no difference in the software you write.)
Hope this helps - Paul
PS if you use Android - disable the auto update option. Chrome decided to update on me half way through typing this response. I lost the lot and started again using a laptop.
EDIT: Just spotted on the link you gave that the relay card needs 15 to 20mA per input. The Netduino digital IOs have different limits and only three of them can source the maximum 16mA. Hence you will not be able to drive the relay card directly without using either transistors or a device like the 74HC595. See the Wiki page on how much current can be drawn from IO lines.
So if I have a serial port do I need an special equipment or can I just plug the wires into the netduino?
#12
Posted 05 November 2012 - 06:54 AM
So if I have a serial port do I need an special equipment or can I just plug the wires into the netduino?
Sorry - no
If you have an RS232 serial port on the PC, you will need an RS232 to TTL converter.
There are plenty of ready built modules out there to chose from.
Some come with a 9-way D-Type cionnector fitted, some are just ready for wires to be soldered on.
Without an RS232-TTL adapter, the serial data will be the wrong voltage and inverted when the Netduino receives it; nothing will make much sense.
Paul
#13
Posted 05 November 2012 - 04:38 PM
Sorry - no
If you have an RS232 serial port on the PC, you will need an RS232 to TTL converter.
There are plenty of ready built modules out there to chose from.
Some come with a 9-way D-Type cionnector fitted, some are just ready for wires to be soldered on.
Without an RS232-TTL adapter, the serial data will be the wrong voltage and inverted when the Netduino receives it; nothing will make much sense.
Paul
Hey paul I have a strange question which you may or may not know the answer to. APC ups have a USB to serial cable that they use communicate but this cable only puts out 5v and it does not apear to be a 232 cable. Is it possible this is a TTL cable ... is there any way to tell by looking at it ?
#14
Posted 05 November 2012 - 06:31 PM
#15
Posted 12 November 2012 - 04:52 AM
#16
Posted 12 November 2012 - 06:54 AM
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users