Category Archives: Robot

Robots and Electronics

Infra Red detection and Photo Transistor Testing

IR is invisible to human eyes. 

There are two main frequency IR emitters are used: 850nm and 950nm. however for detector, the detectable range covers both frequencies.

As we can’t see IR, one way to determine whether the IR LED is working is to digitalize the IR light, which means to look through a camera, you will be able to see blue light which you can’t see without the camera.

Read More

Build your own motor driver!

What is L293D? 

So what’s L293D, and what does motor driver do?

The L293D is a H bridge 16-pin chip that takes an external power supply and drive up to two 5V DC motors (suitable for most of the homemade robots). And with the motor driver each motor can be controlled by 2 input signals to run clockwise and/or counter clockwise.


Components Required:

  1.  L293D (16 pin chip – H bridge motor driver)
  2. 10uF, 0.1uF capacitors
  3. Screw terminals
  4. Strip board

Here is the schematic:


For simplicity, I connected Vcc1 (motor power supply), Vcc2 (chip power supply), Enable 1 and Enable 2 all to 5V DC.

Vcc1 should be connected to whatever the motor requires upto 36V, but in this project or in the near future, i will be just using 3V motors anyway, so that would be good enough.

To enable PWM (for controlling speed), we will need to have individual input for ENABLE 1 and ENABLE 2. But I won’t be controlling speed, so just connect them to the power supply.

The capacitors are optional, the circuit works without them. But to protect the chip, it is considered good practice to connect them to the power supply.

Testing on Breadboard

I then build it on a vero-board and test the result:


After confirming it’s  working! We should plan the PCB circuit and tried to solder it on the stripboard. It was very difficult because the board is so small and there are so many components i need to fit in. Also I haven’t been doing any soldering since second year in Uni… ah… what a pain.

This is what I got:


input1/input3 input2/input4 action

Testing Motor Driver on Arduino

Now, let’s test it with some motors and wheels, see Video at the top. (notice I use the 5V supply from Arduino, this is actually not a good practice as it could harm your Arduino board. it’s better to use external power supply. But as my AA batteries are still on delivery, i will just use it for testing today.)


Learn how to use 4-digit-7-segment LED Display

In our last project, I shown you how to use one digit 7 segment LED display. In this one, I will show you how to use all 4 digits. I will be using the class i created in our last tutorial.

As you might notice, all four digits are controlled by the same LED inputs (a, b, c… ,f, g), how are we going to display different number on each digit? Actually, we can disable the previous digit before we display the next one. If we do this quick enough, human eyes will not be able to tell the difference.

Read More

Using PWM for motor speed control

Just like what we did in our first project, we control the brightness of a LED using potentiometer, we will be using a motor instead of the LED, the only difference is we will introduce BJT to our circuit. The reason we use BJT is because the digital output pins on the Arduino is not powerful enough to power a motor, so we have to have an external power source for the motor. The BJT can be controlled by Arduino output pin, to provide varying power to the motor, thus varying speed.

Actually, it’s not right to say ‘varying power’ here, because it’s a analogue term, and the output pins on an arduino are all digital (can only give constant voltage of HIGH or LOW). The ‘varying voltage’ we see, comes from a useful technique call PWM (pulse-width modulation). It basically varies the percentage of time that the output is HIGH, thus varies the total power it gives. Let me know if you have trouble with it.

coming soon, just realised I haven’t got a BJT… will order some

Using switch to control Piezo speaker

In this project, we will learn how to use a speaker (peizo sounder) and use switch button to change the pitch of the sound.

Sorry about this one, you might find it a bit difficult to digest at first, and I didn’t realise it’s actually harder than it sounds. Anyway, spend some time on the code, let me know if you have problem understanding the code, or you have a better solution.

Read More