March 18, 2011

Arduino relays

I'm putting my newly learned Arduino knowledge to practical use. Since I don't really know any electronics, I went to a local electronics supplier called ETT to see what pre-made boards they have. While looking around, I discovered that they make a custom Arduino board with a mouthful name called ET-EASY MEGA1280 Duino Mega that easily connects to their boards using a simple 10-pin connector.


This is the Duino Mega connected to a 5V relay board. The 5V board can be powered directly from the Duino Mega board which is powered from USB. Also connected is a Sharp GP2Y0D21YK infrared sensor. The sensor is a digital sensor with a 24 cm range.


Here's another relay board also produced by ETT. This is a 12V relay board that needs to be externally powered. Actually I got the 12V board first, but then I saw the 5V board that can be powered from the Arduino. But after getting the 5V board I was afraid that it might draw too much power. But both seem to work perfectly fine.

I wrote a little sketch that controls the relays using commands transferred over USB serial as well as reads the status of the infrared sensor. My first Arduino project is a motorized computer scale system. One relay is used to control the motors of the conveyor belt and the second relay is used to toggle a warning siren. The infrared sensor (which will be replaced by a laser sensor in production) is used to sense when to stop the conveyor belt in order to weigh the product.

Of course, the system has a load cell and a weight indicator that also has to be connected to work. The load cell is connected to the indicator through a special load cell connector, and the indicator is connected to the computer using a simple USB serial port converter.

7 comments:

Elton said...

Hi, I just bought two Sharp ir sensors, the analog one, GP2Y0A21YK and the digital one, GP2Y0D21YK. I am having some trouble making the digital sensor work with arduino (not sure if the sensor is good or not). I see you have GP2Y0D21YK working. I wonder if you can tell me how you connect it to the arduino board.

From your picture, you didn't put a 12kohm resister between the +V and Voutput as suggested by the page 2 of the datasheet, http://media.digikey.com/pdf/Data%20Sheets/Sharp%20PDFs/GP2Y0D21YK.pdf Will that work too?

Elton

FRiC said...

Hi, as you can probably see from the photo, I didn't do anything special in connecting the IR sensor to the Arduino board. But the internal pull-up resistor has to be enabled. In my older code, I have:

digitalWrite(SENSOR_PIN, HIGH);
pinMode(SENSOR_PIN, INPUT);

With Arduino 1.0, you would do:
pinMode(SENSOR_PIN, INPUT_PULLUP);

Elton said...

Thank you for your reply. Did you see the IR led light up through a digital camera? I can see the IR light from the GP2Y0A21YK but not from the GP2Y0D21YK. I suspect the GP2Y0D21YK are second hand and malfunction.

FRiC said...

Hi, I think your IE sensor is indeed defective. I can see infrared light using a digital camera.

Elton said...

thanks.

Parneetha S said...

This is a really good blog. I am surprised that the new technology. thanks for your informative blog.

Load Cell Manufacturers in India | Load Cell Supplier in India

Ask Vinothini said...

I admired your helpful words. Top class contribution. I really hope you’ll write more. I'll continue looking for.
Compression Load Cell | Shear Beam Load Cell