Introduction: Arduino+PICAXE = "robot" Umpire!
Today I'm going to show you how to make a Easy Arduino Baseball Ump! This little system is probably best for scrimmages (informal games) when you have some snooty competitive players so that nobody is complaining about how "unfair" this is ;) I haven't upgraded it so that it has different plays on it. So for now, the only play it can perform is this one:
The batter has hit the ball.
He runs to first base, trying to beat out the throw from an infielder or the sort.
This instructable is more educational for you to get started with the useful PICAXE chip, but the electronic ump is a fun project to do all the same!
If you haven't noticed all ready, I just did the designing and layout and the barebones of the umpire. I'll leave it to you, to do the FUN STUFF (aka "the grunt work")!!!
By the way, I haven't actually implanted circuits into the first-baseman's glove yet... If anybody knows how to safely take apart a glove, insert a small circuit inside, and sew it back together again, then please do comment (see, this is what I mean by "grunt work")
Step 1: Materials
Here's the list of materials you will need (most of which you will already have, unless you are a complete noob (its alright if you are, I'm still one too!)):
-Arduino Uno (~ $30)
-USB-A to USB-B cable (aka "printer cable")
-Arduino IDE (free and available for download at http://arduino.cc
-2 PICAXE 08M2 microcontrollers (available at RobotMesh and only $2.85 each! Es una ganga grande!)
-AXE027 upload cable* (an surprisingly expensive yet absolutely necessary upload cable ~$20)
PLEASE READ THE ASTERISK COMMENT ON THE BOTTOM OF THE PAGE
IT IS VERY IMPORTANT!!!
-3.5-mm stereo socket (another necessity and available for $0.12)
-PICAXE Editor 6** (please read asterisk)
-an electronic brain (computer)
-IR receiver module... (I have a TSOP38238, but any other 38khz-40khz receiver should do fine)
-2 940-950 nm wavelength infrared LEDs (TSAL6200 works for me)
-2 voltage regulators (output 5 volt)
-assorted capacitors (look at schematic in step 5)
-assorted resistors (look at schematic in step 5)
-helping hand (not literally, I mean the stand with the metal claws)
*This is absolutely necessary and although it may just look like a USB to Serial cable, it is NOT. It has some embedded electronics inside and that means that you should NOT use any other cable for uploading and you should also NOT use this cable for other purposes. You will need to install a driver the AXE027, which I will explain in depth in the next step...
**The PICAXE Editor 6 is available for Windows only! If you have Mac or Linux, then use AXEpad instead. All software is available for download at http://www.picaxe.com/software
Step 2: PICAXE Preview
I'm just going to assume that you know how Arduino works. But since PICAXE is a little more obscure, I'll give you a quick cover up. I highly recommend you check out the PICAXE website (http://www.picaxe.com/ ) and that you read the installation PDFs and setup guides. You do not need to read the commands unless you actually want to learn it. I will provide you with the code for the PICAXE.
ALL ABOUT PICAXE
The PICAXE chip is the size of a 555 timer, but is many times more powerful. It's useful for shrinkifying your projects. The PICAXE is programmed via a serial plug connected to the AXE027 cable which in turn is connected to a laptop with the PICAXE programming software on it. In this Instructable, I'll assume that you are using the Programming Editor for Windows. AXEpad isn't all that different anyways. You will need to install two things. The AXE027 cable driver and the Programming Editor.
-do NOT choose the preinstaller... it didn't work for me. Choose the manual ZIP file package instead.
-Make sure that the AXE027 cable is NOT plugged into the computer and open and extract the contents to an easy to access folder.
-Plug in the PICAXE cable
-Ignore the messages for the driver installation that will pop up.
-Go to Control Panel
-Under "Hardware and Sound", select "View devices and printers"
-Select "Unknown Device" or "AXE027" (if it does say AXE027, then there should be a yellow triangle with an exclamation point next to it)
-Right click and select "properties"
-Under properties, go to the "Hardware" tab at the top
-Select/highlight AXE027 or "unknown device". Click properties.
-Click change settings
-Click update driver
-Click "Browse my computer"
-Click browse, and select that "easy to access folder" that the driver is located in
-If windows asks you if you should install, click "install"
-Go to control panel again
-Unplug AXE027 and plug it in again
-At the bottom of the page, under "Unspecified", it should say AXE027 and have a yellow triangle next to it. This is perfectly normal. Just go through the entire process again (starting at right-clicking and selecting properties). If it does NOT have a yellow triangle next to it, then you're done!
PROGRAMMING EDITOR INSTALLATION TIPS
This installation should be quick and painless. There really isn't much help to offer because chances are, you'll succeed in this step.
Step 3: Setting Up the Programming Editor
Open the Programming Editor.
It should look like the top image.
On the left, there should be a long window divided into two sections labeled "Workspace Explorer" and "Simulation". In the upper window labeled "Workspace Explorer", the should be three tabs on the bottom labeled "Files", "Settings", and "Compiler". Click on the "Settings" tab. There should be a tree diagram with two headings "PICAXE Type" and "COM Port".
On the drop-down box under "PICAXE Type", it should say PICAXE-20X2. This is the PICAXE model. You want it the be set to 08M2. When you click the arrow on the right though, you will notice that it is not listed. Simply click the up arrow key several times and the box will scroll up. Select 08M2.
Make sure that the COM port the cable is in is highlighted. Then you are done. If it is not, then you probably have a driver issue. Try these techniques before you try to figure out the driver ...
COM Port issue?
Try reinserting the AXE027 cable. Try closing out and opening the Programming Editor back up again. Try uninstalling and reinstalling it. Try rebooting your computer. If none of these work, then you may have to go to step 2 and do all the "driver installation" steps over again.
Step 4: "Hello World" PICAXE
After all that software issues and stuff, I bet you want to get started sticking things into a breadboard. Well now is the time for that!!! :D
Set it up according the diagrams above(note the ground and voltage-in pins... they are exactly opposite of the 555 timer so be careful!!!).
(I soldered jumper wires to the socket and I highly suggest you do so, too)
We'll blink an LED on for one second, turn it off for one second, and turn it back on again in a loop.
The code is relatively self-explanatory:
CODE "HELLO WORLD"
| high 1
| pause 1000
| low 1
| pause 1000
| goto main
Just in case you're wondering, the 1 in front of high and low stands for "Logic Pin 1". Take a look at the pin-out (C.0, C.1, C.2, C.3... etc., think of it as "logic pin 0, logic pin 1, logic pin 2, logic pin 3...).
Follow these instructions:
1) Insert the USB plug of the AXE027 into the same USB port that you used before
2)Start the Programming Editor.
3)In the Programming Editor, go to the "Settings" tab under "Workspace Explorer".
4)Verify that the correct COM port is selected and 08M2 is selected.
5)Plug the stereo plug on the free end of the USB cable into the stereo socket that is now wired into your breadboard.
6)Check your wiring, and then connect your power supply to the breadboard.
7)Click the button labeled "program" in the Programming Editor window to upload it the chip.*
8)Once it is done, remove the AXE027 cable and then remove the entire stereo jack. DO NOT REMOVE THE RESISTORS!!!
*Notice the "Syntax" button. It checks for any code errors. The "Simulate" tab at the top of the screen opens a window that allows you to simulate what happens on the chip. "Program" uploads it to the chip.
IF IT DOESN'T WORK...
Pull out the plug of the USB cable from the PICAXE breadboard, leaving the other end of the cable attached to your computer. Set your mulitmeter to DC volts, and attach its probes to the bottom two "sections" of the serial plug. Click the program button again, and your meter should show 5 volts briefly coming out of your computer to the plug on the end of the cable. If you detect the voltage, then the software is installed and working properly. This means that you have a problem on the breadboard. Remember, don't forget the 10k and 22k resistors. They are absolutely necessary for the chip to function DURING OR NOT DURING programming. DO NOT FORGOT THEM!!!
If you don't detect any voltage, then the software probably wasn't installed correctly, or is looking for the wrong serial port. Make sure the COM port labeled AXE027 is highlighted! If it is, then try uninstalling and reinstalling the software.
Step 5: Schematic ,outline, and Hardware
Once you've got the PICAXE up and working with Hello World, then you're ready for this step.
Take a look at the schematics and outlines above.
Make sure you have the IRremote library by Ken Shirrif installed... get it here:
Upload the sketches at the bottom of the page to the board and chip and set up hardware accordingly. Test it out.
If the maximum functional range between the glove and base modules to the "brain" module is not far enough, then your infrared LED's might need a little upgrade.
If the umpire works and you're happy with the range, then I guess you're done!!!
If you want, you could put the brain into a enclosure like I did.
I've lain out the groundwork, and its up to your to do the grunt work!!! ;-)
-Figure out how to shrink the glove module circuit and fit it into a glove
GRUNT WORK TIPS
-Use two or three coin batteries instead of a bulky 9V
-Use several pushbuttons wired in parallel
Even if this isn't the most PERFECT thing in the world, you still learned some stuff about PICAXE, right? No? Fine.
But hey! Maybe if you do the grunt work, you can comment your new and improved version of this robot umpire and then nobody else has to do the grunt work!
Step 6: Final
Although I haven't completely figured out the glove module in terms of fitting, I have figured out the base module. If you are doubting, then he you go:
Shouldn't the first-baseman be stepping on first base, too? And if he's stepping on first base, wouldn't he be stepping on the switch? This would give a false signal, right?
Remember when I said in the beginning that this type of design was best for whiny little kids (you wouldn't be using this in the Major Leagues, would you?)? It just so happens to be that in the lower age groups, for first base, they place two bases connected to each other to form one "first-base". The first-baseman steps on the white portion and the runner runs across the orange portion. If you place the pushbutton under the orange portion, then, problem solved!