Control Relay with UNO.

Hello :

I want to do a project with Arduino UNO rv3 . In a few weeks I will buy the device and components. For now I bought a book and as you read 'll buy the other modules .

There is a project that has not left me with PIC quite right in his time under ASM and want to try the world of AVR and if I get it . I managed only control relays from your PC with Windows HyperTerminal on a project, and receive data from other digital presses . He has not left me both at the same time. Led by controlling your porpia serial port interface on C # have made ??manuals you can see here .

This is achieved either by USB or serial port control relays and Arduino UNO has these things . - 8 Relay outputs . - 3 analog inputs . ( A potentiometer and LM35 which is a temperature sensor and another is 8 keys in one analog input with corresponding resistors). - 2 digital inputs . i .[/i]

Now I'll schemes . For now. How do you see this project? Complicated?

I want to know your suggestions. If someone has done something similar , they can express their experiences, if any link are the same, welcome. Ideally, with the possibility to control USB serial port also .

Since making the interface under Visual C # I'm good , do not live by USB and need dirver . With this I want to ask something. With Arduino UNO USB can be used while sending RS232 COM serial port or command ?

I intend to make a new PCB board or ATMEGA328P as the final project. In the field of electronics design and I 'm on that show here schemas to be seen . Still can make suggestions.

Best regards .

It is a medium complicated project. If you know about relays and flyback diodes, opto-couplers, relay driver chips, and power regulators and grounding, it is not hard.

Here are some often used connections:

Do you know processing (although I think this is not useful in this situation):

If you search for C sharp and dot net and arduino, you find many projects.

I don't understand your question about USB and serial at the same time. The Arduino Uno use the Serial interface (via usb) to communicate with the computer. When you upload a sketch, the bootloader uses the same serial interface to write the new sketch into the Arduino.


I'm looking for sample code to control the RS232 serial port directly to the PC with Windows HyperTerminal by pin Arduino UNO.

Pin 0 Rx Pin 1 Tx

You need an Arduino UNO, MAX232, a computer and a Windows HyperTerminal or interface made ??with Visual Studio C # or VB on. Net.

I want to do with Arduino UNO. I have no problem for electronics. I will design the Proteus I want to see the idea.

The finished PCB must have a USB and DB9 connector. You want to use a port he chooses. As principal, I now focus on the physical DB9, later I will make the USB.

The PCB has 8 relay outputs and LED.

When sending a command from the HyperTerminal of Windows or an application made with C #, relay and LED are switched on or off.

I'm looking for sample code on dirtectamente controlling computer serial port.

A greeting.

The Arduino Uno creates a (virtual) serial port on the computer via the usb, using RX and TX. So all you have to do, is to connect the usb of the Arduino Uno to the computer.

Start the HyperTerminal program on the computer.

Load a sketch for Serial in the Arduino, and that's all. Have the look at the examples for the Serial library (lower-right on this page):


I prefer to send orders directly from pins 0 and 1 Arduino UNO with the serial port without using USB. Since I work, I tested this code.


// Serial Output 
// by BARRAGAN <>

int switchpin = 8; // interruptor conectado al pin 0

void setup()
   pinMode(switchpin, INPUT); // pin 0 como ENTRADA
   Serial.begin(9600);    // inicia el puerto serie a 600bps

void loop()
   if(digitalRead(switchpin) == HIGH) //si el interruptor esta en ON
      Serial.print(1);    // envía 1 a Processing
   } else {
      Serial.print(0);    // en caso contrario envía 0 a Processing
   delay(100);     // espera 100ms

Now I have to experiment with better code.

If I send an ASCII character ‘t’ HyperTerminal serial port from Windows, or Arduino Led lights a relay.

At least I want to learn to do the necessary on and off a led connected to Arduino UNO from the serial port with Windows HyperTerminal or interface I made with C # as shown in the photo above code.

The sample code I got it at the end of this link.

I keep experiencing …
Any help or suggestions are welcome.