This was my first Picaxe project. Actually, my first complete circuit to design and build. The hardest part of the project is the soldering, but if I can do it you can do it.
Basically, it is a little box with a push button and two light sensors (3 inputs). It has an LED and piezo (2 outputs). I have it programmed to respond to light levels with corresponding beeps and blinks. It can be reprogrammed to respond differently. I "play" it by shading the two photo-resistors with my hand. It is quite addictive.
If you like circuits and programming, and if you are just getting started in either, this is a good project for you.
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: Materials and Tools
8-pin dip socket thingy http://fwd4.me/0woR from Radio Shack or similar)
Project Box (I used a thrift store computer speaker $.75)
Light Dependent Resistors X 2 (light sensors or photo resistors as they are often called)
LED (two if you want, I'll explain later)
Peizo (I salvaged one out of an old computer, sometimes they are in greeting cards, toys or novelty ties)
Push button, the momentary kind (I salvaged one out of an old computer power button)
Toggle switch (to control the power!)
Wire (I used 22-gauge. But you can use smaller wire as long as it is insulated and flexible. Solid core is easier for soldering. You don't need much. I actually salvaged a lot of it from, you guessed it, an old computer.)
5V regulator (http://fwd4.me/0woS from Radio Shack or similar)
9V battery with battery cap or holder (I think you could also use 3 1.5V batteries) Scavenge old broken toys and electronics.
Soldering Iron (solder, helping hands, magnifying glass, etc.)
Hot glue gun
Razor knife and other cutting tools
Drill with small bits (depending on your project box and design)
Small gauge Wire stripper/ cutter
Serial adapter cable OR USB serial adapter cable
Pixaxe programming software
Step 2: Design Your Circuit
I didn't include this in the tools, but you will learn more if you prototype your circuit on a breadboard before you build it. If you understand how it works on a breadboard then you can be more prepared to improvise your design based on your specific needs. Also, you probably want to program your chip on the breadboard and make sure it all works BEFORE you build your circuit. That way if it's not working that's one less thing on your troubleshooting list.
Explanation of the circuit
If you open "Picaxe Manual 3 - Interfacing circuits" from the Picaxe Editor Program Help menu, you'll find that there are lots of ways to interact with the Picaxe 08M. We'll be interfacing with two outputs: LED and a Peizo sounder. And we'll be interfacing with three input circuits: a switch and two "Light Dependent Resistors" (photoresistor or photocell).
We will also wire the circuit so that it can be powered by a 9V battery with an on/off switch and can be reprogrammed without disassembly. My schematic will show you how to do each of these but, reading and understanding the manual on these topics may help you modify this project with your own ideas.
Step 3: Solder It
The smaller you design your circuit, the more difficult it will be to solder, but the cooler it will be.
All I can suggest is that you take your time and plan out the placement and order of your solder joints. There's not much room for mistakes. Use a multimeter and test as you go. Just like most things in life, It is easy to get turned around and do the wrong thing. Try not to do that.
I used bare wire for most connections and therefore had to avoid crossing wires. It might be simpler (though messier looking I think) to use insulated jumper wires. Your choice. I don't really have any helpful tips that aren't well written in other instructables. This was the most daunting part of this project. I honestly thought I couldn't do it, but I tried anyway. My first attempt failed and I was almost too disgusted to even attempt to find the mistake. Luckily, I persevered. I quickly found a couple of fixable errors and wah lah. It actually worked. I remained happy for days.
The last things I attached were the switches, programming jack and LDR's. Make sure to use wire long enough to accommodate opening the project, getting to the battery, etc. But don't make it so long that you can't cram it all in there. Depending on where you are putting them on your project box you may want to hold off on connecting your LDR's, LED, and programming jack. Read the next step to see why.
Step 4: Drilling Cutting Gluing
Warm up your glue gun.
Drill some appropriate sized holes for your switches, LDR's and if you want it on the outside, your LED. Most switches come with threading and a nut that make it easy to mount them in the right size hole. If not, glue that puppy in there. For the LDR's I drilled a whole slightly smaller and put it right on the seam of my plastic speaker box. If you put the hole somewhere else make sure to plan ahead and stick wires through the holes BEFORE you solder them to the LDR's. (guess I'd better go add that info to Step 3) I used some hot glue behind the LDR's to make them stick in place.
Step 5: Plug in the Beast
This is the part where you throw the giant mad scientist switch, electricity crackles, then you scream, "It'S ALIVE, IT'S ALIVE!!!"
Well, not quite yet. You still have to give it a brain. Carefully plug the PicAxe 08M into its socket making sure it has the correct orientation.
I'm assuming if you found out where to buy a Picaxe that you already know that you need software to program it and a serial cable or USB to serial converter/cable to connect to it.
From that information you may have also wisely surmised that you will need a program to send to it. I've included one below. I'm sure it could be much improved and welcome comments.
Plug it all in, install the appropriate drivers. Make sure your software is set to the right type of chip and to the right COM port. Switch on the power to your Giggle Box the click "Program" !!!!!
Step 6: Laugh Like Dr. Frankenstein
Did you know that "Frankenstein" wasn't the name of the monster, but of the man who created the monster?
Anyway, hopefully the last step worked for you. You won't know until you push the momentary switch thus "tickling your giggle box" and starting the program. Actually, the program starts the moment it is finished installing, but it is written to wait for input from the momentary switch.
If it didn't work, here's some troubleshooting tips.
1. Double check your cable. If you are daring like me, you might have hacked together your own programming cable. It's a good way to save money, but it can be difficult, especially if there is a USB involved.
2. Did the Giggle Box make sounds during programming? If so, that means it is receiving a signal from the computer and at least trying to send one back.
3. Did your software post an error message? Double check the Picaxe editor Options. Mode should be "PICAXE - 08M" and Serial Port should be "COM 3" or wherever your device shows us.
4. If the settings are correct and the Editor cannot detect or communicate with your device then you have a circuit problem. Hopefully one of your loose wires got laid across something else when you were cramming it all in. Use electrical tape in areas of possible short circuits. If it still doesn't work, you need to go through with your multimeter and check every connection one at a time.
If you are afraid it is a problem with the code try a simple program like:
This should blink the LED on pin 2.
If nothing works post your problem here and maybe I or someone can help.
Step 7: Enhance Adapt Explore
As you can tell if you dig into my code I've already made lots of changes. Thus the weird variable names and "v5" designation.
If you are into programming then you can probably think of lots of great ways to make the Giggle Box do all sorts of cool stuff. I started out trying to do complex math on the LDR readings to give a more controlable tone. I settled on more simple math resulting in more random notes. You could add code that makes the GBox turn off in the dark. I had code in v4 that made the LED "breath" when in standby mode. I took it out for a easier to read program, but it was cool.
If you are into circuit design maybe you are thinking of alterations to make it more interesting. I've been thinking it would be cool to make two of them with an LDR and an LED positioned so that they could "talk" to each other and maybe play a duet.
If you are into art maybe you could put this project into a painting or sculpture and use it to make a statement about the relentless hopelessness of post-PostModernity and the fallacy of the current philosophical establishment. (Don't you agree that the current philosophical establishment is definitively NOT established. I ronic.)
Have fun. Let me know if you do anything with it.