Can I use RS232 to control leds/relays?

I’m very new to vvvv, but I have some experience with MAX/MSP a few years ago…

I would like to know if it is possible to use vvvv to control two LEDs?

If it is possible I would also like to know if it is possible for vvvv to do a frequency-analysis of audio that is played through the computers sound card (by another program on the computer)? The result of the analysis is what will be used to determine weather the LEDs should be turned on or off…

There is some info on how to get power from the RS232 port on this page: http://www.epanorama.net/circuits/rspower.html (look for “Controlling the relays with software� ~ bottom of the page):

''The serial port DTR and RTS pins can be controlled by directly writing to the I/O-port address which is the RS-232 port base address + 4.
The bits what you should set to that port are following:
• Bit D0: DTR pin state (0 = -12V, 1 = +12V)
• Bit D1: RTS pin state (0 = -12V, 1 = +12V)
• Bits D2-D7: Leave those to be 0
In the relay controlling circuit examples above +12V energizes the relay and -12V does not nergize it. Here is a short table of different values you send to serial port and the states different pins get:
Value DTR RTS
sent state state

0 -12V -12V
1 +12V -12V
2 -12V +12V
3 +12V +12V"

I would like to know if I would be able to utilize this using the RS232 node or in some other way? How should I setup the RS232 node?

In case you haven’t guessed it I’m looking for a very cheap solution to drive a couple of LEDs with vvvv.

If it is possible I would also like to know if it is possible for vvvv to do a
frequency-analysis of audio that is played through the computers sound
card (by another program on the computer)?

this is easy. the FFT help patch will help you with that…

''The serial port DTR and RTS pins can be controlled by directly writing to
the I/O-port address…

i havent done this before, but by selecting different values at the Hardware Handshaking pin in the RS232 node, you can set the DTR/RTS lines to dífferent values. right now i somehow fear not all combinations are possible - so two leds might be a problem - but you should give it a try.

on the other hand - accessing the serial controller is one of the other few reasonable things to do with the Port node. your document gives the following table:

||
Serial port |Typical I/O address

COM1 | 3F8h

COM2 | 2F8h

COM4 | 378h

COM4 | 278h
||

This gives a very educated guess which of the right adress. while vvvv currently doesnt allow you to read the DOS memory location where the actual position is stored, you can double-check them in the serial port settings in the device manager. as long as you dont change your hardware configutation this adress is very likely to stay the same.

your document continues:

''The serial port DTR and RTS pins can be controlled by directly writing to the I/O-port address which is the RS-232 port base address + 4"

if you have a real serial port on your motherboard (no usb port) it is quite probably that you can control it with the above mentioned method. set the port node to the right adress and fiddle with the bits. make sure that nobody else wants to use that port, note that you are doing things here your operating system doesnt think they can happen.

one major annoyance within vvvv: you need to enter the value in decimal. so fire up calc.exe, switch it to “scientific” mode. now enter the adress for the port you want to use, like 3F8 for COM1, learn that hex 3F8 is decimal 1016. and add 4 to get the place to of the status register =1020.

Thank you very much for your quick reply! I will try to experiment and se what happens. Also I need to do some more research on the idea/setup I’m planning.

If I make some progress I will reply to this thread.

I think vvvv is a very cool program! Also I really dig the general attitude on the homepage and the tutorials. Cool :)

oschatz:

If it is possible I would also like to know if it is possible for vvvv to do a
frequency-analysis of audio that is played through the computers sound
card (by another program on the computer)?

this is easy. the FFT help patch will help you with that…

I have had a look at the help file “FFT (DShow9) help.v4p” but it doesn’t help me much as I don’t know what it is supposed to do. It doesn’t produce any output when I have music playing in another program… In the AudioIn-node in “FFT (DShow9) help.v4p” it has selected my SB Live! Wave Device as the driver (input pin to the right). On the AudioIn-node output-pin it says: “Audio: [ Supports DirectShow ]( Supports DirectShow )”. See attached image.

Also… I totally can’t figure out how to get FFT to help me analyze for specific frequencies in the sound. Was this supposed to help me: Spectral density - Wikipedia :)

To clarify what I need to do: I need to detect if there is 19.200 Hz signal in the left or the right side of the audio-signal. If there is this should trigger one of two LEDs (depending on weather it was in the right or left side of the stereo signal).

I managed to turn the LEDs on and off using the port-node. It works great. I thought that would be the hard part of my small project… :)

Bye the way, if you are wondering what I’m trying to accomplish I can reveal that I’m trying to build some Audistobe glasses for used for brainwave entrainment. It seem like a good idea to use vvvv to deliver a multimedia experience directly brain :)

FFT - DShow9.gif (5.1 kB)

the screenshot is basically fine. but you are supposed to see some wavy lines dancing to your music in a style you very much have seen before.
did you dvelve into the deeper menus of your windows audio mixer yet? vvvv defaults to the standard windows settings for recording from the sound card. your problem might be a mixer setting issue. check if the record selector is set to audio mix - otherwise your audio playback will not reach the fft node. or connect some external audio or mic.
there are two nodes in vvvv for controlling the settings of the windows mixer, but its probably easier to start with the windows control panels…

I discovered the DirectSound option in the windows mixer yesterday. I now se the lines dancing to the sound and I can’t stop watching. Since I can also turn LEDs on and off I’m sure I can finish the project without too many difficulties.

Thanks for all you help oschatz!

(resolved)

make sure a rs232 node is present & enabled in the patch.
you need no connection between the port & rs232 node.


hi, i basically wanna do the same- 2 leds, connected directly to the serial port.

however, i can´t get the “port”-node to work, when i send “1”, “2”, “3”, etc nothing happens.

both leds react to the rs232 node, one to the on/off-pin, the other to the hardware-handshaking pin.

maybe can you post the patch?

thanks, florian

Hi, I`m trying to control a matrix of 15x20 leds and draw some geometric forms on it via RS232,
is it possible to scan the renderer pixel info and send it to RS232
pixel by pixel?
or do it all with numerical data and generate circles, lines, etc?
i´ve been trying with spreads, but its no working,
thanks
lalo

You might want to start a new post about your specific Q.

Not sure how you want to control 15 * 20 pixels direct on an RS232, but with some additional hardware it should work. Please post some links, as I am scratching the micro electronics surface.

What kind off info are you sending to the leds?? (only ON and OFF aka 0 and 1) or are we talking RGB here??

I/we have build (and controlled) a 60 x 6 RGB LEDwall, but that was controlled via DMX.

Just post a small example on how you control your LED array.