Archive for November, 2008

Arduino Composite Video

Wednesday, November 26th, 2008

Television! Teacher, mother, secret lover. –Homer J. Simpson

Having only discovered the duino recently, I’m constantly searching for applications that push the limits of what can be done with the device. There have been several sketches posted that will output composite black and white video to your TV with a very simple circuit, but the most interesting of these to me is the Arduino Pong code by Alastair Parker. What I’ve done is strip the code down to just the intro screen in order to simplify the idea and get my mind wrapped around it. Check out the following schematic, code and resulting output.

Download the code.

Arduino Composite Video Schematic

Arduino Composite Video Schematic

To change the on-screen text, grab a sheet of graph paper, create a rectangle that is 38 units wide and 14 units tall, and mark the pixels you would like to turn on. After that, it’s simply a matter of changing the “setPixel(x,y)” lines in the code. Have fun and as Homer says: Let us all bask in television’s warm glowing warming glow.

Composite Output Result

Composite Output Result

The circuit on breadboard

The circuit on breadboard

More PWM Basics

Monday, November 24th, 2008

Recently I did a video attempting to describe and compare the differences in a digital PWM signal and an analog signal.  To supplement my recent video, I am sharing another video I recently found while traversing the tubes.

This video is about using PWM with FPGA’s— it’s not directly related with micro-controllers and is a bit technical.  For us though, Mrs. Shelly gives a good definition, examples and usages of PWM and the info could be helpful to those who still lack a good understanding of what PWM is doing.  The first 4:30 of the video is the only relevent part to us in the *duinoverse, after that it’s just about software implementation of FPGA’s …

Signal Analysis: Analog V.S. Digital PWM!!

Tuesday, November 18th, 2008

Signals come in two basic types – Analog and Digital. Analog signals are capable of being any value, where Digital signals are called “discrete”, meaning they capable of being in only one of two states! The terms for these two states of a Digital signal are varied but include; ON/OFF, TRUE/FALSE, 1/0, HIGH/LOW, etc.

So what’s that mean? A good example of a Digital signal is a light switch in your house. You can either flip the light switch ON, or flip the light switch OFF. To follow this line of thought, an example of an Analog signal would be a light with a dimmer switch. With a dimmer switch you can adjust how bright or dim the light is, anywhere from completely OFF, to completely ON.

Okay… The Arduino is capable of analog and digital INPUT, but only capable of digital OUTPUT. When working with the Arduino we see that there are 6 analog pins and 14 digital pins. (It should be noted that if you have no need of analog INPUT; you may use the analog pins as extra digital OUTPUT pins — declaring them as digital pins 14 – 19)

So, if we are only capable of digital OUTPUT on the Arduino, how are we able to dim a LED?

Dimming LED's with digital PWM

dimming LED with digital PWM

ENTER PWM!! (Pulse Width Modulation) Some, but not all pins on the Arduino are capable of Digital PWM OUTPUT. Basically, PWM is the digital way of mimicking an analog OUTPUT.

To better show the difference between Analog and Digital PWM, I put together a simple LED dimmer circuit and hooked up an oscilloscope to view the Analog and Digital PWM signals. I took some video of everything in action to better serve as an example.


Analog Signal VS PWM Signal from Morgellon on Vimeo

The sketch I used in this video is available here: http://serverwillprovide.com/icuubi/examples/analog_vs_PWM.pde

Distance Sensor

Monday, November 17th, 2008

I wanted to see the range of my new distance sensor, so I hooked it up to some led’s.

/*Distance Ranging to LED Bar*/

//this can be done better in a loop
#define led1 2
#define led2 3
#define led3 4
#define led4 5
#define led5 6
#define led6 7
#define led7 8
#define led8 9
#define led9 10
#define led10 11

//the analog distance sensor
#define distancePin 5

//incoming value of distance sensor
int val = 0;

//this can be done better in a loop
void setup(){
pinMode(led1, OUTPUT);
pinMode(led2, OUTPUT);
pinMode(led3, OUTPUT);
pinMode(led4, OUTPUT);
pinMode(led5, OUTPUT);
pinMode(led6, OUTPUT);
pinMode(led7, OUTPUT);
pinMode(led8, OUTPUT);
pinMode(led9, OUTPUT);
pinMode(led10, OUTPUT);

//you do not have to declare inputs, all pins are input by default
pinMode(distancePin, INPUT);

Serial.begin(9600);
}

void loop(){

val = analogRead(distancePin);
Serial.println(val);

//turn all pins off, can be done better in a loop
digitalWrite(led1, LOW);
digitalWrite(led2, LOW);
digitalWrite(led3, LOW);
digitalWrite(led4, LOW);
digitalWrite(led5, LOW);
digitalWrite(led6, LOW);
digitalWrite(led7, LOW);
digitalWrite(led8, LOW);
digitalWrite(led9, LOW);
digitalWrite(led10, LOW);

//these values may need to be changed for your setup
if (val < 600){
digitalWrite(led10, HIGH);
}
if (val < 560){
digitalWrite(led9, HIGH);
}
if (val < 520){
digitalWrite(led8, HIGH);
}
if (val < 480){
digitalWrite(led7, HIGH);
}
if (val < 440){
digitalWrite(led6, HIGH);
}
if (val < 400){
digitalWrite(led5, HIGH);
}
if (val < 360){
digitalWrite(led4, HIGH);
}
if (val < 320){
digitalWrite(led3, HIGH);
}
if (val < 280){
digitalWrite(led2, HIGH);
}
if (val < 240){
digitalWrite(led1, HIGH);
}

delay(50);
}


Arduino Distance Sensor from droops on Vimeo.

MPGuino

Friday, November 14th, 2008

I am not a car guy, but I enjoy my Scangauge and knowing my MPG every second of driving.  We have really changed how we drive and consume gas with this simple ability.

So how do I do with with an Arduino?  I had no idea other than there is some way to get the information from the OBD port.  Well it seems that you can use one injector lead and do this, there is even a project that spends time working on this.  Presenting the MPGuino!!

You can build this yourself, or you can get a kit for 40$.

Here is their main page

Here is their wiki

Here is a forum post with schematics

Here is how to put it in your car

I will hopefully order one of these soon and get to play with it.

Guitar Hero Type Games

Thursday, November 13th, 2008

Morgellon had a cool idea to build a clone of one of these games.  ie press a button of the right color when you are told to do so, to keep the music playing.

So we are both working on 2 totally different ways to build such a device and randomly i stumbled across this awesome video.  Instead of recreating the whole game, they built a tool to actually play the game.  In the video this is not done with an Arduino, but it could be done with processing and an Arduino.

Wireless Communication Part 1

Wednesday, November 12th, 2008

Today we are going to be playing with some 433 mhz radios from Parallax.

Transmitter $30

Receiever $40

Datasheet

Now this is only going to be one way communication, as these will either transmit or recieve but not both.  This pair is extremely easy to use, they say these will range over 500ft and will speak between 12,000 – 19.2 K baud.

To use these, you simply put them inline with the wired example, on the transmitter there is a ground, power, data and  power down.  Don’t worry about the power down, you know where to plug the other 3.  Data is going to be your tx pin.

On the reciever there are those 4 pins and a signal pin.  This signal pin shows how strong the signal is from the transmitter.  You can read this like any other analog value.  Your data pin goes to rx.

Transmitter

Transmitter

Reciever

Receiver

Transmitter Closeup

Transmitter Closeup

Receiver Closeup

Receiver Closeup

Breadboard Arduino

Monday, November 10th, 2008

I have seen these on the internet, so I sat down to make my own.  I really wanted the ability to put a programmed ATMega168 on a perfboard and make it do things in small projects without having to use a RBBB Freeduino ($12).

I used the documentation from the RBBB Freeduino located here (pdf).

ATMega128 Pinout for Arduino

ATMega168 Pinout for Arduino

RBBB Schematic

RBBB Schematic

The first step is to build the power supply.


You need to test it to make sure you are getting ~5v

Then you build the basic Freeduino

And plug your power supply into the Freeduino

I used two led’s, one for power indication and one for pin 13.  if you dont use these you can loose 2 resistors and 2 led’s.

I put one of these on a perfboard

There is no way to program the chip on the breadboard or on the perfboard, other than taking out the chip and using an Ardunio to send sketches to it. (yes i know about other ways, but you still have to pull the chip out)

So I finished the breadboard up with FTDI

So now I can use a FTDI cable and send data to and from my breadboard Duino.

droopsDuino

Sunday, November 9th, 2008

Coming off my breadboard and barebones duino, I decided to just build my own.  Wow I suck at wire management.

Mine has a few fancy features (other than lots of wire).  For example I have some headers for plugging up an LCD and some for a FTDI cable.


I also have some headers for additional ground, 5v, and 9v from the battery.

For some reason this thing works and is around the same footprint as a regular Arduino, just a bit taller.  I also learned a few things, the led’s for serial communication come from the FTDI chip on fancy Arduinos, as does the 3.3 volts.

Wired Communication Between Arduinos

Saturday, November 8th, 2008

To do a wired serial conection you need 3 wires, rx, tx, ground.  Don’t forget the ground, that had me all confused and frustrated.  The tx (transmit) and rx (recieve) wires need to be crossed.

I wrote a simple sketch that starts at 0, outputs that value, increments by 1, outputs that value and so on.  This sketch will be used for all of my serial communication between Arduino posts. code

LCD output

LCD output

So I get my sketches running, one outputting that information and the second reading it and displaying it to an LCD.

Then I wire everything up.

This allows tx and rx between the 2 Arduino’s dont forget the common ground.  With wireless you do not have to have that common ground, my next 2 posts will be on such things.

Download the sketches I used



  • Viagra online
  • Order cheap cialis
  • Buy viagra no prescription
  • Cialis online
  • Buy generic cialis
  • Order propecia no prescription
  • Cheap propecia online
  • Propecia online pharmacy
  • Order levitra online
  • Cheap price cialis
  • Online pharmacy levitra
  • Buy viagra online
  • Buy discount levitra
  • Cheap cialis online
  • Propecia hair loss