Friday, May 20, 2011

Shopping List

If you have just heard about Arduino and are thinking about getting one, don't just buy the board on it's own. You don't buy a PlayStation / XBox without buying a game, and the same goes for the Arduino. If you just buy the Arduino by itself, you will get bored pretty quickly. In fact, I don't know why the Arduino doesn't automatically come with a breadboard, some wires and a few LEDs. Having said that, there are a few companies out there that have put together some pretty good kits.

I am not going to list them, because I am sure you know how to Google, and I am not going to tell you which one to buy, however I will tell you that I decided to buy the Sparkfun Inventor's Kit. You can work out which one suits you.

The Sparkfun inventor's kit not only comes with an Arduino UNO, but also a wide array of bits and pieces to muck around with. You can buy it in Australia from Australian Robotics.

•Arduino Uno USB
•Arduino and breadboard holder
•Printed 36-page Oomlout manual
•12 color circuit overlays
•Clear Bread Board
•74HC595 Shift Register
•2N2222 Transistors
•1N4148 Diodes
•DC Motor with wires
•Small Servo
•5V Relay
•TMP36 Temp Sensor
•Flex sensor
•Softpot
•6' USB Cable
•Jumper Wires
•Photocell
•Tri-color LED
•Red and Green LEDs
•10K Trimpot
•Piezo Buzzer
•Big 12mm Buttons
•330 and 10K Resistors
•Male Headers

The manual that comes with the kit is not the best manual in the world, but it does redirect you to a much more useful site online. I thoroughly recommend this kit for beginners. It will point you in the right direction, and once you start tinkering, there is no turning back. You won't stop talking about it. Totally awesome.

And when you get through the 12 sketches (and their recommended variations), you can't help but feel a sense of power. The power to create light, create sound, create movement, and the ability to discover the world around you like you never have before.

Regardless if you decide to buy a kit or not, there are a few individual items that are essential. If you don't buy them now, you will later on.
  • Multimeter
  • Soldering iron
  • Helping hands with magnifyer - good for holding that component / wire when you need a 3rd hand
  • Alligator clips
  • Breadboard
  • Wires - to connect your sensors/motors etc  (Male/Male wires) and (Female/Female wires)
  • LEDs
  • A button or a switch of some sort - preferably one that can be put on a breadboard.
  • Resistors (330K and 10K)
  • External Power supply for Arduino board :  to liberate your Arduino

Feel free to put a recommended kit in the comments.

Tuesday, May 17, 2011

From Blank to Blink

I have to start somewhere, so why not start NOW.
This blog aims to capture my journey of discovery as I dive head first into the world of electronics, armed with an Arduino in one hand and a borrowed multimeter in the other.

I aim to share my learnings with you, and not only highlight my successes, but also my failures.
I have a curious mind, so I hope I don't set anything on fire.
If you decide to follow in my footsteps, you do so at YOUR own risk.

I would prefer if you used me as an example of what NOT to do, but if I inspire you, please let me know.


Image made with Fritzing : http://fritzing.org

Saturday, April 2, 2011

Controlling fan or motor speed with PWM

On the first part, I talk about switching any 12V DC or higher electronic components ON or OFF. This can be easily done using an optoisolator and a 12V reed relay. In this article, I will be using a different component to control the speed of the 12V fan or motors using Pulse Width Modulation (PWM).

The TIP-122 are Darlington transistors that can support voltage up to 100V. It consist of two transistors with resistors and diode all inside a TO-220 package. You can use TIP-120 that support up to 60V. Please refer to the TIP-120/TIP-122 datasheets for details specifications here.

TIP-122
I've wired u my circuit like the schematic diagram below :-

TIP-122 fan speed control

The input of the circuit is using analogRead(0) to read the light level from the light dependent resistors (LDR). Depending on the light level, the value is converted by the ADC to 0 to 1023. Since the PWM can only take value of 0-254, I will divide the ADC value by 4  to match the PWM value.

The 12V DC supply is separate from the Arduino 5V supply but shared a common ground.

The LCD is to display the LDR value for debugging purpose. Cover the LDR or shine a light to it to see the fan speed change.

Arduino Pin 9 (PWM) connect to the TIP-122 Base (B) pin.
The 12V fan connect to the TIP-122 Collector (C) pin and the Emitter (E) pin connect to the Ground.

Sketch to control the 12V fan speed using PWM is as below :-

   int ldr = 0;
   ldr = analogRead(0)/4;


  // if light level is room light, turn the fan speed higher

  if ( ldr < 125 && ldr > 40 ) {
    ldr = ldr + 50;
  }


  // if value is less than 40, do not switch the fan ON

  if ( ldr < 40 ) {
    ldr = 0; 
   }
  
  // else run the fan speed according to light level up to 255


  // send PWM value to TIP-122 base pin
  analogWrite(9,ldr);
  delay(500);