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.

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:


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.


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.

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 =;
    // say what you got: