Monday, March 11, 2013

Lets Make A Battery...

A long time ago in a galaxy far far away, there was a man named Alessandro Volta who had this cool idea; stack silver and copper separated by leather discs in a glass cylinder and hook wires to the top and bottom, then dump a bunch of electrolyte (they didn't have Gatorade back then) in the cylinder and with wires attached to the top and bottom contacts, you could shock your fellow researchers. Okay it wasn't that long ago; it was 1800, but his basic design is what powers modern batteries. Add two dissimilar metals in an electrolyte and you get a charge that flows from positive to negative (which is actually backwards, but we can't change our paradigms)

To repeat the experiment you will need:

alligator jumper wires
4 pennies
4 zinc washers
1 LED or lamp and holder
1 multimeter with leads
2 lemons or 4 small dishes of lemon juice
adult supervision

With help from an adult, cut the lemons in half equatorial. Jam a penny and washer in each one half way, or alternatively, clip a penny and washer to each dish of lemon juice. Connect the pennies and washer in series, meaning connect a penny to a washer then that penny to another washer and so on. DON'T connect the last connection, instead, connect an LED or lamp. If you are using an LED, it has polarity, so if it doesn't turn on immediately, switch the contacts. Now hook the multimeter across the contacts of the LED or lamp. What is the voltage? How long does the voltage stay the same? How long does the LED light? How long does the lamp light? What is the voltage of each cell (one lemon or individual bowl)? What is the total voltage? When you wire them in series, what happens to the voltage? What would happen if you wired them in parallel (copper to copper, zinc to zinc)?

Project from Make: Electronics, by Charles Platt, O'Reilly Publishing, 2009

Saturday, February 18, 2012

Making a Stepped Potentiometer from a Rotary Switch

I've been asked to build a project for my boss that involves selecting between several modes on the front panel. I'm using an Arduino Uno to send serial messages to various types of UHF radios, and not wanting to use 6 I/O pins and a mess of wires, I created a resistor ladder on a rotary switch that will only use 1 analog pin on the Arduino. Think of it as a 6 position potentiometer, fixing the values between 0 and 1023 to 0, 205, 409, 612, 818, and 1023. The precision is usually within 1-2 integers of the value, so you'd definitely want to do a map() function to give some room to wiggle in between the numbers.

To build the circuit, you'll need a 6 position rotary switch and 5 resistors. I used 10 ohm resistors, 1/4 watt. 1/8 watt would probably fit better between the switch poles, but I don't find them versatile enough to stock them. Wire them from one pole to the next leaving the common pole untouched. Once soldered, don't trim the end resistors and you can use the leads to plug right into a breadboard. I did not solder the ends yet so I could later solder wires there. I wrapped some 22 gauge wire around the common pole and wired it with one end of the resistor ladder going to ground, one end going to +5v and the common pole going to analog pin 0. I modified the wiper sketch below:

int analogPin = 0;     // potentiometer wiper (middle terminal) connected to analog pin 0
                       // outside leads to ground and +5V
int val = 0;           // variable to store the value read

void setup()
  Serial.begin(9600);          //  setup serial

void loop()
  val = analogRead(analogPin);    // read the input pin
Looking in the serial monitor and switching the rotary switch to the different positions gives me consistent values +/- 1 integer.

If you required an audio taper instead of a linear taper, you would just need to calculate the resistor values based on a logarithmic curve. Dig out your old math book.

Sunday, November 6, 2011

Robot - FrankenBot - My First Robot!

Wanting to make a robot with my scout troop (go 1349!), I decided I needed to fully complete one myself before I tried to teach 8 impressionable 11-13 year olds. I had tried to make a robot before, and for some reason couldn't drive both motors simultaneosly. Turned out to be a programming problem, because I used basically the same setup as before, but couldn't' get both modified servomotors to turn.

So last night, I started by modifying the servo motors- cutting the block that prevents full rotation on the main gear, and removing the control circuitry, resoldering the red and black wire, and removing the unused signal wire before tucking everything back in its place and screwing it back together.

Putting my mind to brainstorming, I came back frustrated on how to build the chassis- it had to cost me nothing, be fully able to disassemble, but had to be rigid enough to stay together well. I thought about bending some polycarbonate and drilling holes for the servo motors, but I don't have a laser cutter, and any time I do too much work with acrylic I get frustrated and it ends up getting cracked by my drill bits (I need a plastic bit). Donning my lab coat with integrated pocket protector (helps me think) I had an epiphany-- I could just zip tie the motors to the holes in a lego technic beam! I got to work. It didn't take long to build up a decent chassis. But where to mount the microcontroller? I didn't want to totally abandon my acrylic sheet idea-- I had some in the garage, and if I took enough breaks and was careful enough, I lied to myself that I would not get frustrated. So I snapped several technic beams together and taped them to a scored and snapped 5" square of acrylic. Using the holes as the template made drilling more accurate, but unfortunately, my cheapness got the best of me-- I intended to drill 4 rows of holes and use them to mount ANY chassis to it, so it would be more versatile. However, about 99% of the holes "spidered" or split out into cracks on account of the wrong type of drill bit. I decided going to bed and working on it the next day was best.
This morning, I scored and snapped a new 5" square of acrylic and instead found a what I believe to be ingenious way of mounting it. A shorter brick beam is inserted sideways into the main vertical beam's holes and then the cross axles are inserted with a few spacers just like standoffs. I then drilled 4 holes (no spidering!) for the axles. Once the acrylic sheet was fitted, I mounted the Arduino by drilling holes small enough for some small "hex" PC standoffs that I self tapped into the acrylic-- it was critical that these holes would not spider, which they didn't. Once the microcontroller was mounted, I actually realized that my bot would need power, so out of the projects graveyard came a 9 volt battery holder with Arduino barrel jack and a 4xAA holder. Turns out both fit perfectly in my chassis, and after thanking the universe for aligning just enough for me to be this successful, I drilled the holes in the battery cases for zip tie mounting. Once mounted, I wired everything to my Adafruit motor shield, and uploaded some test code. After some fiddling with the code, the bot was moving around, albeit in a very erratic fashion. Now I actually have to spend money and get some sensors.

Some Ideas:
5mm LED's fit very snugly into the Lego Technic beam holes, so I was wondering about making a IR LED/Transistor combo. (yes I know I can just buy a sharp sensor already built)
PING))) ultrasonic sensor(s)

Simple touch switches with whiskers

Also, I want to have a small solar panel trickle charge the AA's.

Thursday, October 14, 2010

Instructable - Flashing Reflective Backpack

With the sun rising well after 8, it becomes very dark and unsafe to cross busy streets on my wat to the bus stop each morning. So, I created this cool flashing backpack! It works on a simple Astable 555 circuit, and has lots of reflective tape to up the coolness factor. Way to be safe!

Instructable available here.

Geek on!

Sunday, September 26, 2010

Lego - Technic Drill

Now with more motor!

Dylan and I built this lego technic hand drill. It has a two directional drive, a 1:1 gear ratio, and one speed. Still, it is awesome. With such bad ergonomics!

Build on!

Robot - ABR-1

This is what I'm loosely calling at this point ABR-1, Arduino Based Robot 1. No, it does not yet move. I'm not sure why, but I've plead for help on the Adafruit forums. I started by using hacked servos, where you remove the stop and the key that turns the pot, then center the pot. Eventually that wouldn't have worked, because I'd need a servo plugin for the eyes, a servo turning based PING sensor, that I haven't bought yet. It will sit on the upper platform, directly behind the Arduino. I was lucky enough to get some 9 volt battery holders that will keep the batteries from flying around. They lock the battery in place, much like battery holders you would find in commercial toys.

I've been working on this little platform for six months. You would think I would be finished by now, but I want to get it right. This was my entry in the Make Magazine robot build, but I didn't get finished in time, so I scrapped the CD body idea, because if you make a robot (or anything) out of garbage, you are left with garbage with a few fancy parts. So instead, I made the structure out of plexiglas scraps I had laying around and some aluminum standoffs. I think it gives a clean look. Eventually, I want some BOE bot wheels, instead of the cut plexiglas that I have now. The nice thing about the platform is that it is expandable when the budget rolls in. If only I could get it working! More on that later.

Geek out!