March 14, 2011

How to Make your own Breadboard Jumper Wires

Jumper wires are handy little things that you can pay a lot to have them made, or you can make your own really cheap.


All you need are: 

  • A piece of LAN wire (you can buy this for 50 cents a meter, or a couple feet), this is what the inside of it looks like. Strip the outer insulator, and get the 4 couples of wires. So we have 8 wires that you can cut at the size you want.


March 11, 2011

Build a Thermometer Using the LM335 Sensor and Arduino

Today we are building a digital thermometer. Parts we need are: 
  • Arduino Uno
  • 1 x 2ΚΩ resistor
  • LM335 temperature sensor
Now let's start with the basics. What is the sensor? You can find the full data-sheet here, but with a few words it's a diode. The voltage on the edge of the diode is proportional to the temperature. For every Kelvin degree increase in temperature the voltage increases by 10 mV. As I said in my previous post the read accuracy of the input pin is ~5mV, so the temperature we read will be half a degree accurate.

Now let's see the circuit we need to build.

 

March 9, 2011

Using an LDR (Light Dependent Resistor) with Arduino

Today we are looking on how we can use the analog input on arduino, to read a sensor. This is basic knowledge but very useful in robotic projects.

So what is an analog input? Unlike the digital input which can read two states, 0 or LOW or no voltage and 1 or HIGH or high voltage, the analog input can read up to 1024 different states which are 0,1,2,3,4,...,1022,1023. These are voltage equivalents for when you break 5V into 1024 equal "pieces" of 0.00488V each. That means that 0V is 0, 0.00488V is 1, 0.00977V is 2, ... , 4.99512V is 1023. So basically what the input is, is a scale of 0-5V in 1024 states.

Now let's see how a sensor works. Most sensors use a physical characteristic to transform the physical property that you want to measure into something that can be used in an electrical circuit.

The Light Dependent Resistor, as it name suggests is a resistor whose value changes depending an how much light it receives on it's top. The more light it gets that less resistive it becomes, i.e. more current can pass through it. But remember we said that the input on arduino can only read voltage? So how do we transfrom this resistance change into voltage change?

March 6, 2011

Random Arduino Bits 'n Bytes (part 2)

(This is a follow-up article. Read the first part here.)

Now the bit-level manipulation part of the code:

/*
 * randoms_seed.pde
 * -----------------
 * Generates a random number, then prints it
 * through the serial port in decimal and
 * binary format. Does not use an initial seed
 * so it prints the same set of random numbers
 * everytime it is reset.
 *
 *
 * http://spacetinkerer.blogspot.com
 */

long randNumber;


Random Arduino Bits 'n Bytes (part 1)

Let's take a look at the random number generation on arduino, and on bit-level manipulation. This lesson will be helpful for a project I'm preparing.

So arduino has the random() function that when called returns a long (that means a long integer) number. This function can be used in two ways. The first is calling it with the max range of probable number that you want the function to produce.
For example if you want the  function to return a single digit integer you will call it this way:

random(10);


Notice that just like in C-language code the number start from 0, so 0-9 are 10 numbers.
The second call is by providing a range in which you want the number to be in.

random(0,10);

This will still return a number between 0 and 9.


March 1, 2011

Fixing the 8u2 Firmware Bug on Arduino

Last week I bumped on a problem. I was tinkering the serial_echo program.

/*
 * serial_echo.pde
 * -----------------
 * Echoes what is sent back through the serial port.
 *
 * http://spacetinkerer.blogspot.com
 */

int incomingByte = 0;    // for incoming serial data

void setup() {
    Serial.begin(9600);    // opens serial port, sets data rate to 9600 bps
}

void loop() {
  // send data only when you receive data:
  if (Serial.available() > 0) {
  
    // read the incoming byte:
    incomingByte = Serial.read();
  
    // say what you got:
    Serial.print((char)incomingByte);
  }
 Serial.println();
  
}


February 24, 2011

Serial Port Echo with Arduino

Here is another example of using arduino with the serial port. I took an example from the arduino site here, and tinkered it. I wanted to create a program to echo the actual letter that you send through the Serial Monitor program. The example on the arduino site returns the ASCII values of the characters sent, so I tinkered it to send the actual characters back. So here is the program:



February 23, 2011

Motor Speed Control through a PC Serial Port with arduino

Last time I showed you how to "speak" to your arduino through a serial port. Today we will use that knowledge to control a motor! About a week ago I took apart an old CD Burner and found 3 motors. I will use one of those today.

The program is very straightforward, just like yesterday we send data from the Serial Monitor in the arduino program, the board "listens and responds" to them.

Here is a video of the program running, I explain the code after that.


February 22, 2011

Arduino Control over Serial Port

So let's build something more difficult. We will see how you can control arduino over a serial port. We turn the onboard LED on and off through the serial port.
Let's see the video of the program working and then we will explain the code.



February 16, 2011

Scavenging Components from Discarted Electronics

I took apart an old (about 10 years old :P) CD burner, I had in my closet, and found a wealth of components. 
I found 3(!) motors, about 15 transistors, one Green LED, surprisingly no resistors, at least no typical ones, one button switch which will work great for those digital input tutorials at arduino.
I also found one laser diode, that the CD burner used, which I broke trying to remove it.. It's too bad because they can make great laser pointers, or even work as lighters. 
Here are some images of the things I found:

February 14, 2011

Arduino UNO Programming Basics

So let's take the blink program and tinker it!

void setup() {               
  // initialize the digital pin as an output.
  // Pin 13 has an LED connected on most Arduino boards:
  pinMode(13, OUTPUT);    
}

void loop() {
  digitalWrite(13, HIGH);   // set the LED on
  delay(1000);              // wait for a second
  digitalWrite(13, LOW);    // set the LED off
  delay(1000);              // wait for a second
}

February 12, 2011

Arduino UNO + Ubuntu 10.10

I just installed Arduino UNO in Ubuntu 10.10 from the instructions here, go where it says "Ubuntu without (arduino) package". Then download the software (the linux version) and it should work great!

------------------------

UPDATE -- There is a visual walk-through, on how to install arduino on an ubuntu clean install here.

Basic Electrical Components

There are quite a few tutorials here, to help you get started with arduino. They are basic programs to learn the use and most of the capabilities of the board. I scanned quickly through, to make a list of the basic stuff you will need, so here it goes:

LEDs:
Most programs require up to 3 LEDs, so buying 2-3 of each basic colors (Red, Green, Blue) is a good idea, so it isn't very monotonous. They are quite cheap, they will not be a great expense.

Resistors:
  • 100 Ohm
  • 220 Ohm
  • 4.7 KOhm
  • 10 KOhm
I think those are most of the resistors used. Buy 2-3 of each, they are quite cheap too.

My First Arduino Test

So to check your arduino board, there is a simple program. To begin with, you have to  find an A/B USB cable, it's this one:

The board uses this cable to power itself if you don't have a power adaptor to plug it in.


 --------------------

Next you have to download the arduino software, you can find it here.
There are different versions depending on your operating system,

February 10, 2011

My Arduino Uno!

Today I bought my ARDUINO UNO. 
It's quite smaller than I expected. Came in a small paper case. Seems very sturdy, nice construction overall. 
Came as shown in the picture, no wires or anything else, so I have to go buy some LEDs, jumper wires, resistors maybe a breadboard, to start tinkering.
I also need a power adapter, but i think the A/B USB cable can power the board through the PC.
Anyway, I will post the results from my experiments, so check back.