Wednesday, 31 July 2013

Arduino: Photocell, thermistor, RGB LED, DC Motor

In this post, I will describe an arduino project to light an RGB LED using a photocell and to turn on a DC motor using a thermistor. Here's the picture of setup:


Equipments are:
 - Arduino UNO R3
 - 16x2 LCD
 - 10k potentiometer
 - Photocell
 - Thermistor
 - RGB LED
 - DC Motor
 - L293D H-bridge
 - 220 resistor x 3, 1k resistor x 2, 10k resistor
 - Switch
 - Breadboard
 - Jumper wires

Below picture is the Fritzing Diagram:


In the diagram there's no switch, it's optional to turn on/off the backlight of LCD.

The main idea is to use sensor values for controling other devices. For instance in this project, when the photocell value is between 0 and 60, RGB LED gives RED light, and green and blue for other lightlevels of photocell. Besides, when the temperature reading of thermistor is above 25 degrees C, dc motor begins to turn. Also this limit value of temperature can be sent by serial communication to arduino.


Arduino pin connections are as follows:

// Arduino pins used for LCD
LiquidCrystal lcd(12, 11, 7, 6, 5, 4);

int photocellPin = A0;
int thermistorPin = A1;

// Arduino pins used for LED RGB
const int red = 3;
const int green = 8;
const int blue = 10;

// Arduino pins used for H-bridge
const int motor1Pin = 9;    // H-bridge leg 1 (pin 2, 1A)
const int motor2Pin = 2;    // H-bridge leg 2 (pin 7, 2A)
const int enablePin = 13;    // H-bridge enable pin



No comments:

Post a Comment