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! ; )