Also, I have not found any posts or videos of these experiments, so I might as well do it.
But first, I needed a serial port. Most late-model computers do not have the old-fashioned 9-pin RS232 ports for what is normally called a DB9 connector but really is DE9. Fortunately, I hoard old computers and have a 14-year old Windows XP computer with serial ports on the motherboard. If there had been on a PCI card rather than the motherboard, I could have swapped that out into my regular desktop. That left me with 2 choices: fire up the XP machine and use that to program the PICAXE, or buy a PCI card for my desktop. Since I doing this because I'm cheap, I chose the former. PCI cards cost US$7 and up from Amazon, Newegg, and the like, and as low as $4 on eBay. If I decide to use the PICAXE for more than this project, that's an option.
The XP machine started up fine, and I was able to download and install the PICAXE software according to the book instructions (or see the PICAXE web site). I still needed a cable. Here again, I had two options:
1. find a serial to something cable, cut it, figure out which wires go to which pin, and connect the 3 wires I need to the PICAXE
2. make my own
Again, this is a makers' book, so I decided to make one. A quick Google yielded this set of instructions. I bought a DB9F (as in female) connector from Amazon. Following the aforementioned instructions, I soldered 24" solid core wires to the pins I needed:
red wire to pin 2 (Rx--receive--computer in)
green wire to pin 3 (Tx--transmit--computer out) I didn't have white solid core wire
black wire to pin 5 (Ground)
I heatshrinked the connections for insulation.
I then cut a servo wire in half and kept the half with the end that I could connect to a 3-pin header on the breadboard and:
- slid small heatshrink on each lead
- slid larger heatshrink over the 3 wires to the DB9
- spliced the servo wires to the connector wires with solder, matching the wires by color (red/red/ black/ black, white/green)
- heatshrinked the splices
- heatshrinked the cable
- snapped the cover on the serial connector end
Tools and supplies ready
to make the PICAXE cable
|
DB9F ready to solder |
Next step: configure the breadboard:
- add a 2.1mm barrel jack to bring unregulated 9V to the breadboard via wall wart or 9V battery
- add a voltage regulator circuit to deliver clean 5V to the power rails on each side of the breadboard
. the circuit consists of 2 100uf capacitors, 2 .1uf capacitors, and an LM7805 voltage regulator
. Charles' instructions are good, see schematic - add the PICAXE to the breadboard and connect it to power and to the computer serial output
. I have a PICAXE 08M2, pin 2 is serial in and pin 7 is serial out, so the red wire (computer out) goes to pin 2 (see next bullet), and the white wire (computer in) goes to pin 7 (i,e, computer in to PICAXE out, computer our to PICAXE in)
. actually the red wire goes to a breadboard hole in a row between a 10K resistor that goes to a breadboard ground rail and a 22K resistor that goes to PICAXE pin 2--keeping pin 2 pulled to GND when it's not receiving
. PICAXE pin 1 goes to a breadboard 5V rail, and pin 8 goes to a breadboard ground rail - Add an LED for testing--connected to PICAXE pin 6 and on to GND through a 330Ohm resistor
Fritzing diagram of circuit--the business on the left is the voltage regulator circuit |
I had a heck of a time with the voltage circuit. I kept getting ~9V out. I tried multiple units, and checked ny wiring. Finally I set up a circuit like the L7805 datasheet, and it worked--exactly 5V out. I was going to submit another erratum on the book, but as I wrote ti it didn't make sense that I would get 9V out, so I rewired it in a different spot on the breadboard: 4.98V out. I moved it back to the original location: 9V out. I'm doing something stupid, but I'm ready to move on to the PICAXE and test my cable, so I'll put it back where it works and declare victory.
breadboarded circuit with messy wires |
Now, we're ready to test the cable and circuit.
Oops. I cannot get the XP machine to recognize the PICAXE./ I have a problem with my cable (although I don't think so, but I'll check), the circuit, my computer, or something else. It could be the breadboard--I suspect that's the problem with the voltage regulator circuit--see above. I've done some preliminary checking, but I'm not there yet. The book is absolutely no help on this since Charles went the non-Maker route, I'll do another post if/when I get something working.
Oops. I cannot get the XP machine to recognize the PICAXE./ I have a problem with my cable (although I don't think so, but I'll check), the circuit, my computer, or something else. It could be the breadboard--I suspect that's the problem with the voltage regulator circuit--see above. I've done some preliminary checking, but I'm not there yet. The book is absolutely no help on this since Charles went the non-Maker route, I'll do another post if/when I get something working.
No comments:
Post a Comment