Ah, what a fun!!! :) Today we built the “Light following
rover” a variant of what +Unmesh suggested in one thread on Internet of Things Pune group discussion.
We bang-on-started (Thanks to Dhiraj) with first
understanding basic circuitry and designed a simple circuit to check the light signals
in six directions i.e. Three in-front and Three in-back. i.e. left, center,
right in clock wise direction on Front and Back side of the rover. Based on
this understanding we proceed to build the rover. Our requirement was simple
"The bot should move to direction where there is maximum light among all
the directions".
Then second thing was to calibrate the LDRs so as to
understand the variations in light (high, low and normal values), also
normalize the values of LDRs as each might give different values for same
amount of light. We checked each LDR ad-hoc way, normalized the values in
program directly.
Now, the big problem was, we need to control/drive Geared DC
motor(s) using our Induino board. As you know, It’s difficult to control the
motors directly (motors require more current and voltage than the typical
output values and we needed special circuit for the same).So, we needed some
Motor driver circuit. Thankfully Dhiraj has already built an Arduino shield
"2-Channel Actuator Controller" which is capable of controlling upto
4 DC motors. Here, We have used the same Actuator controller shield to drive
the motors of the rover. So, using this shield, We are actually controlling two
motors via a single actuator channel. You can also build ckt using L293D/ L298 or
buy a circuit to control the motors popularly known as HBridge/ DC motor
controller.
Now, we needed the power source and few 1K resistors to
build the sensor circuit. Sensor ckt is very simple as shown in the diagram
below. Each LDR’s signal will be
inputted to Induino on Pins A0 to A5. Also motors are controlled via Digital
Pins in Output mode 2, 3, 4, 5, These are directly interfaced via the actuator shield.
As mentioned, Motors on each side of the chassis are shorted
together. That means motor connected on Left side of chassis are shorted and
connected to one output socket of ‘Actuator controller shield’ while other side
to other socket. This Shield has 4
relays, 2 relays are used to control single socket’s current direction. Make
sure all the motors move in one direction before screwing. J
Sketch below is loaded and Fun begins… Here we are controlling the forward motors with Pins 2, 4, so code is written in such way. Your pins might differ so do take care of those.
We are looking forward to add collision detection soon....so stay tuned!!!