27 Dec 2011

How to use Ultra Sonic sensor (HC-SR04), demonstration with LCD.


the HC-SR04 is different from most of those commonly seen on the market, which have 4 pins compared to 3 pins. But the operation principle is the same, transmit signal, and depends on when the signal is received to estimate the distance.

21 Dec 2011

"Stalker" -- Quadruped Robot Project

Quadruped Robot Project -- The Stalker

Inspired by the fighting unit "Stalker" in Starcraft.

Project has been re-created and being maintained on this page:

20 Dec 2011

"Wally" -- IR Detection Robot enhanced version V2



1. rebuild Tracking Head with Styrene plastic, to replace the cardboard one.
2. introduced libraries for motor control, and IR sensor, to increase user-friendliness
3. improved object-following algorithm, introduced "object-avoiding" as well.

16 Dec 2011

"Wally" -- IR Detection Robot V1

I will update the functionality of this robot, and upload some videos.


Object following:

bad points:
1. head needs to be rebuild with better material for more smooth performance.
2. coding needs improvement.

14 Dec 2011

IR 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.

9 Dec 2011

Building a 2 dimensional moving Servo (for mounting Sensors on)


This one hasn't got too much technical stuff involved, all the operations are from previous tutorials. The main things would be the turning head that I made purely from cardboard, and a couple of screws.

7 Dec 2011

DIY: build your own motor driver!

What does it do:

it will take an external power supply and drive up to two 5V DC motors (suitable for most of the homemade robots). Each motor can be controlled by 2 input signals to run clockwise and/or counter clockwise.


28 Nov 2011

How to control a Servo


In this one, servo is programmed to be controlled by two buttons, one turns servo to the left and the other one turns it to the right. When the servo is turning, corresponding LED will be switched on to indicate the operation.

IR obstacle detection Robot

Today, I happened to come across this website, describing how to build a very simple robot without any electronics knowledge. It's very interesting and easy. But it suggests a budget of over $110 which is very high for such a simple robot.

Therefore I decided to design and build one with the same functionality but lower cost.

Let's see how much it would cost approximately (I got all the prices from ebay):

Arduino UNO                - £15
Servo                           - £3 (usually sold in bulk)
IR distance detector      - £2 (will only need 2 or 3 units, I bought 10 from China for £3 ;-p  )
Motor Driver (L293D)     - £2 (cheaper than building one yourself!)
Gear Motor                   - £13 (better than using the motor directly as we need higher ratio, slower movement)
9V PP3 battary               - £3 (I use rechargeable so more expensive)
resistor/capacitor/wire     - £2

other accessories          - £5 (varies really)
Wheels                         - £7 (or £0 if you could make some yourself)

Total                              ----- £40 to £52 (which is $62 to $80 on today's exchange rate!)

I have divided the robot into several parts, and we will be building and testing each part before we put them together. The green arrow indicates the interactions between these parts.

23 Nov 2011

No. 7 - Learn how to use 4 digit 7 segment LED Display (second half)


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.

20 Nov 2011

No. 5 - Use PWM to control motor speed (using BJT)

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.

No. 6 - Learn how to use 7-Segment LED Display (first half)

This is what you will get at the end of the tutorial:

7-Segment LED Display is a very useful component, but also a very confusing and difficult piece to use for beginners. It won't be difficult once you get it working for the first time.

19 Nov 2011

No. 4 - Using potentiometer to control Piezo speaker for various pitch

In this project, we will be using potentiometer to vary the pitch of the sound. This is basically the same as controlling the LED, the only difference is we need to calculate a corresponding pitch in the pitch array. Don't worry if you don't understand, let's jump to the code and you will see. 

No. 3 - 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.

No. 2 - Using switch to change display patern of 5 LEDs

In this project, I will show you how to control multiple LEDs, and use a switch button to change displaying pattern. I will also show you how to include header file to make code tidier.

No. 1 - Use switch and potentiometer to control a LED

In our first project, I will be showing you the basic connections of a LED circuit. To make it more interesting and challenging, I later on replace the switch with a potentiometer, to control the brightness.

Components and Tools that you might need

I listed some if not all necessary components and tools that I will be using in my projects. They are more or less to Arduino projects anyway. I spent less than 40 pounds on all these tools and parts from Ebay, which is not too bad.

18 Nov 2011

Introduction: before you start

Arduino is really fun and powerful! What it can do are beyond your imagination! You might find it helpful spending a few minutes read through this article before you start bidding on Ebay for your first Arduino board! ; )