Thinking about my first PICAXE Project...

laserhawk64

Senior Member
...and I've come up with a couple ideas.

The requirements are simple -- I want to use the PICAXE 08M that I already have, from my starter kit. I don't *have* to use the included "Proto Board" PCB, (I prefer Perf anyways!) but I'd like to keep costs to a minimum.

Here's what I've thought of so far, as options...

(1) I've always wanted an oscilloscope. OK, "always" is an exaggeration ;) but it's been a while. Look at this and tell me how hard it would be to adapt that to a set of probe leads and use the 08M USB prog cable I have instead of that rather antique COM port connector (which is too old for my laptop!). If it's simple and cheap, I can do it. Time? I have plenty of time.

(2) I came across a link, actually it's part of the sig of a member here named Jamster. He came up with some code for a joystick mouse, and expanded it for a touch-panel mouse. (Link to thread, from Jamster's sig.) I wouldn't mind trying to do this, although it's nowhere near as practical as the first option -- my laptop already has a touchpad, and I've a spare USB one (one of the ones with a calculator function built in) for a project that is probably never going to happen (I have a lot of those!).

I'm inclined to stay away from DIY musical instruments as I'm unable to carry a tune in a large dustbin (buckets are right out!) -- I create noise, not music ;) Also blinky LEDs are generally quite boring to me. I think if I used an *RGB* LED and got it to color-cycle, that would be nifty for all of about 0.5s.

Actually, on the subject of LEDs...

(3) Had an idea once for what is best described as a model of a "sci-fi power generator" that hasn't been built yet (notice a theme?) -- it calls for a sort of Larson Scanner like circuit, that I couldn't figure out how to build. You know those 'throbbing' or 'pulsing' LED circuits (eg Apple power light on standby or whatever)? Yeah, like that, but four LEDs in sequence... one fades in, and as it fades out, the next fades in. Also I want to generate a sort of 'electrical hum' sound (speaker and a bit of PICAXE BASIC wizardry?). Not sure if this one can be done with a single PICAXE 08M... but maybe. Maybe.

TBH I like #3 the most. But I'm sure you folks have suggestions...? I'd love to hear them!
 

westaust55

Moderator
...and I've come up with a couple ideas.

(1) I've always wanted an oscilloscope. OK, "always" is an exaggeration ;) but it's been a while. Look at this and tell me how hard it would be to adapt that to a set of probe leads and use the 08M USB prog cable I have instead of that rather antique COM port connector (which is too old for my laptop!). If it's simple and cheap, I can do it. Time? I have plenty of time.
Well the video for that PICAXE 08M oscilliiscope for under $5 has been removed and the note below says "Schematic coming soon." whenever that may be.
There is in fact a schematic but just for a potentiometer conencted to an ADC input.
Suggest respectfully that with your 08M (not 08M2) and 255 bytes of combined program and EEPROM space that you abandon that idea.
If you want a PICAXE based oscilliscope do a search for the project by forum member womai.

(2) I came across a link, actually it's part of the sig of a member here named Jamster. He came up with some code for a joystick mouse, and expanded it for a touch-panel mouse. (Link to thread, from Jamster's sig.) I wouldn't mind trying to do this, although it's nowhere near as practical as the first option -- my laptop already has a touchpad, and I've a spare USB one (one of the ones with a calculator function built in) for a project that is probably never going to happen (I have a lot of those!).
That is doable (Jamster has done the hard work for you)

(3) Had an idea once for what is best described as a model of a "sci-fi power generator" that hasn't been built yet (notice a theme?) -- it calls for a sort of Larson Scanner like circuit, that I couldn't figure out how to build. You know those 'throbbing' or 'pulsing' LED circuits (eg Apple power light on standby or whatever)? Yeah, like that, but four LEDs in sequence... one fades in, and as it fades out, the next fades in. Also I want to generate a sort of 'electrical hum' sound (speaker and a bit of PICAXE BASIC wizardry?). Not sure if this one can be done with a single PICAXE 08M... but maybe. Maybe.
But you mention that flashing LEDs and even RGB's will hold your attention for about 0.5 seconds. ?????

But I'm sure you folks have suggestions...? I'd love to hear them!
This question has been asked before. try a forum search for recommendation.
What is your budget?
Other than a PICAXE 08M, what other components, hardware, power supply, toools, experience, etc do you have?

As a personal thought, you have been asking a lot of question but seemingly thoughts are somewhat at random if you are starting to consider a FIRST project.
It may sound a bit harsh but you need to think about what you would like to build, define the inputs, outputs, define the scope/functionality, select a PICAXE with the capacity (IO and program spaced and speed) to perform the task and start from there.
 
Last edited:

laserhawk64

Senior Member
@Jamster -- no worries :D

@westaust55 --Criticism well taken.

I have a lot of ideas -- at least two worth following every day, I'd say. What I don't have a lot of is money, and as these tend to need that, they also tend not to see completion.

I also have a short attention span, and I recognize that this doesn't help things.

As an explanation for the seeming contradiction between "LEDs are boring" and "I'd like to build a model with blinking LEDs" -- an LED that blinks at 1hz on a breadboard is, to me, very little if anything. It makes me think, "OK, I've done that. It was very, very easy. I didn't learn much and it's not terribly useful, so now what?" ...whereas if I build something much bigger, and it looks fairly nice (a challenge for me -- my favorite working material is cardboard!) then I can be quite satisfied with a few blinkies and a hum -- IF they wind up looking/sounding quite nice. I'm something of an artist, so having a project come out looking nice (or at least, as nice as I can make it!) is important to me.

Besides, that pulsing/throbbing effect is a bit less harsh (and more complicated) than a simple blink, you know?

Regarding the rest --

My usual budget is about us$50/mo., but it's not really that simple. It's $20 OR $30 every two weeks, and the amounts alternate. Generally: around the 10th of the month, I get $30, and around the 25th I get $20. If I'm not too impulsive (another challenge) then I can spend the whole $50 on this, per month, for however many months as necessary. That said, it's probably best if I keep this to a one- or two-month project, and of course, the less money spent the better.

Power supplies are not a big problem -- I have a small collection of wall warts, one or two of which are 5v,2a supplies -- and I have plenty of experience with either making them permanently attached, or changing the connectors at the wire ends! That's no big.

Tools? I've got a really nice soldering iron now (got it for Christmas from my father). It's the Sparkfun one that's variable-temperature. (IIRC it can put up to 50w in that tip!) I've also got the really crunky Radio Shack one that preceded it -- 25w, "plug it in and go" style, slow to heat, and the tip is on its way out -- but that's a spare at this point. I've plenty of solder (the kind with lead in it), and both wick and pump for fixing mistakes. I'm clumsy as heck with the wick, so I prefer the noisy pump, but there's a trick to both for sure.

On the less-circuit-oriented end of things, I have plenty of tools for building things -- almost all hand tools though. I've two corded drills (a VERY nice older Rockwell, recently fixed, and a newer, less trustworthy Black&Decker that I got while I was repairing the Rockwell), plenty of screwdrivers (including a security bit set and a driver for it -- yay, I can take apart gameboys now *rolls eyes*), a couple of hacksaws (and a spare blade or two), a couple of wood saws (including a Stanley FatMax as well as a cheap miter box and backsaw set), and a metal keyhole saw (cheap, from a local home-improvement store chain -- you're supposed to be able to change the blade from "wood" to "metal" but it's mondo hard and I've lost the "wood" blade anyways). I've file (only one, half-round, slightly rusty) and sandpaper (100 grit). Tin snips (and plenty of standard scissors, some stronger than others), diagonal "parrot-beak" clippers, needlenose pliers, regular pliers, three hammers ('tack' mini-claw, regular claw, and 4lb sledge), a rubber mallet (scuffed up). I've a pipe cutter as well. I have only three C-clamps (huge, smallish, and dang-dinky sizes), but that's not a big problem. I rarely need to clamp stuff! I've got a couple power sanders (that weird rounded triangular style, and some sort of disc-style thing) but they've not been used in a long time so I don't think I trust 'em. (I've also got a barrel-style drill sanding kit.) I *might* have a belt sander, but I don't care to use it... too noisy, too brute-force-y, good only for stripping paint/stain/finish IMO.

I've got plenty of bits for the drills as well -- the security bit set will work if necessary, but I've a Black&Decker bit set that's quite a selection, and a separate thing of spade bits going up to IIRC 2" -- although I believe I've lost the 2" bit so it really only goes up to 1-1/2" or 1-3/4" (have to check). Standard drill bits go up to 1/4". I've got wood bits that go a teensy bit higher... 3/8" maybe? (Guess I've got to check that, too.) No proper hole saws that I'm aware of.

Oh, and if absolutely necessary, I can borrow my father's two cordless dremels. Those are nice, but they take FOREVER when I use them. Maybe I'm being too cautious!

Experience... with circuitry, very little (but plenty of knowledge eager for the chance to be used). With the tools I have, rather a goodly bit. I know (generally) what I'm doing, although the devil really IS in the details -- and I have been known to trip on details!

I know that's far more detail than you probably were looking for, but I also hope it's rather useful.
 

Jamster

Senior Member
Best bet is to come up with a list over a couple of months and as you think of them sit at the PE/favorite simulating software and see if it's pheasable, if it isn't take it off the list. Then after the few months of testing and thinking you'll know which ones you stand a chance of making and then can ask the forum for opinions. Currently I've got a few ideas and the way I plan on doing them has completely changed for the better :)
 

laserhawk64

Senior Member
Here's what I'm thinking at this point. If I can throb two LEDs and output that hum, from one PICAXE chip, then that's enough to justify getting a 14M2. The 08M can be a proof-of-concept demonstrator, and I can't imagine it's THAT hard to change the code from "throb two LEDs back and forth" to "throb four LEDs in a sequence". The hum should sound like a microwave doing its thing, only very quiet -- a "rougher" sound output than a white noise machine, but fairly quiet. Like the green transformer boxes you see near apartments.

I see those things as taking up three wires -- 1 per LED plus 1 for the speaker. Can do on a 08M if the processing power is there, I think. Shouldn't be too hard, then, to get a couple resistors, LEDs, and a cap for the speaker. Although: somewhere I have a peizo beeper off a computer (not the decades-older 2" speaker), but I've no idea of the ohmage so I'm not sure if it can be direct-drive or not. I'd have to dig it out.

So does this make sense -- put together a two-LED "throbber" circuit with the PICAXE, and get that --and the hum-- working, then move on to bigger things?
 

russbow

Senior Member
Why not have a shot at coding your idea.
Post it on the forum, even if it fails the syntax check.
That way you will get help......
..... And you will have started on your picaxe journey.
 

laserhawk64

Senior Member
The PICAXE Programming Editor is downloading. Did this up in Wordpad, it's probably about as far from correct as possible, but we'll see... dang, and I thought it'd be easy since I've used BASIC a goodly bit. Not so much! (I'm still thinking in procedural code, the kind with line numbers in it!)

Anyhow, here's what I got...
Code:
init: output pin3,pin5
	pwmout 1 pin3,150,100

main:	pwmduty 1 pin3,150
	pause 50
	pwmduty 2 pin5,150
	pause 50
	goto main
Things that concern me, already --
(1) I hope I at least got the PIN ADDRESSING right! (This is for a 08M, not an M2 -- so the C.* pin nomenclature isn't there.)
(2) Can one even output PWM on more than one 08M pin?
(3) Gave up on the speaker bit, as I couldn't think of how to implement a do/loop in the background. Is that possible?

I did reference the PICAXE website's list of commands and how to use them, as well as this thread here.

Alright, now it's your turn, folks... what did I do wrong (other than "everything"), and how would YOU do it better?
 

westaust55

Moderator
If you download and read the PICAXE manuals in manual 1: http://www.picaxe.com/docs/picaxe_manual1.pdf
at page 9 you can see the functions available on each pin on the 08M.
There is a single PWM pin = IO pin 2.

In PICAXE manual 2: http://www.picaxe.com/docs/picaxe_manual2.pdf
Under the PWMOUT command you are referred to the pin out diagrams to ascertain exactly which pin has PWM capabilities.

In the Programming Editor, there is a wizard to help you set up the PWMOUT/PWMDUTY command parameters.

With respect to the program code, you only need the actual pin number (ie 3 ) not the entire “pin3” to designate the pin. For the newer M2 and X2 parts when you use those later, then you use the port.pin nomenclature such as “C.2”

Have a look at the program snippets which follow the commands in PICAXE manual 2 (and the on-line Commands web pages) for command usage.
 

laserhawk64

Senior Member
...so I need 4 pins labeled "pwm" on the pinouts, in order to run four LEDs like this...? I'm guessing there's no way that's gonna happen with a PICAXE...

Would it make any sense to output PWM on IO 2, and then switch between the two LEDs with a pair of transistors toggled by the PICAXE's remaining two outputs...? I'm guessing "no" but I figured I'd ask...
 

westaust55

Moderator
Don't guess - read the manuals more.

Have a look under the HPWM and HPWMDUTY commands available on X1, X2 and M2 parts
 

laserhawk64

Senior Member
It does appear that the 14M2 has four HPWM pins... lettered A through D. This raises (for me, at least) two questions --
(1) can all four be used, essentially, at once? ie, init all, then run through the repetitive sequence A B C D ?
(2) ...and what the !@$~ do I do with the 08M that is now completely spare? I hate to waste a perfectly good chip... particularly one like this...
 

westaust55

Moderator
Please read about the HPWM single mode in PICAXE manual 2 (V7.9) pages 86 onwards and in particular bottom part of page 87.
Each HPWM pin can be independently controlled only on some PICAXE chips.

You will need and X1 or X2 part (but not 40X1 or 40X2 5 Volt part)

Keep the 08M for some later project with simpler requirements.
 

laserhawk64

Senior Member
X1/X2 parts are rather expensive to me... although everything's relative, I suppose.

Been thinking about this some more. I think, with what I've gleaned from previous posts about creative ways of handling inputs, that I could do something interesting. I wouldn't use it (this would be a musical thing), but I have a friend who would, and he'd probably love it. What I'm thinking of, is a polyphonic version of the classic Forrest Mims Toy Organ, maybe even with a "mode" button that would change the set of sounds playable.

I figure seven inputs, each with a different resistor value. I know I can't implement a 'real' lookup table with an 08M, but maybe a set of array variables (mode switch would select arrays, input switches would select the value(s) from the arrays) would work? Thing is, programming is way hard for me -- especially object-oriented stuff. I've never used an array, so I don't know how -- and Wikipedia is being it's usual thicket-of-jargon self on the subject. If I could understand arrays, then this might work.

Polyphonic is (fairly) easy to handle here -- if I can do it within the limits of the program space! Just, every combination possible for two (maybe three, maybe) buttons out of seven... Og no math good, so I've no idea how many combinations that is... I can say that 7! (7 factorial, all possible combinations for seven buttons) comes out to 5040, but I must've slept through the part of the class where they said how to do it when you don't want to go the whole way... oops.

Basically, what I'm picturing is...
Input pin --> resistor value -> voltage value input via ADC -> comparison op between ADC value and array variable sets -> output PWM frequency called for from array, as long as the Input pin remains active. Mode switch is an interrupt that changes which array variable (of two or three) is selected, with the result being different sets of sound output.

Think of it as the world's worst Casio electronic keyboard :p like I said, it would be a gift for a musically-inclined friend. He's into 8bit sound stuff a little, so maybe one of the modes could be lo-fi 8bit sounds like from a Commodore or something. Dunno yet.
 

BeanieBots

Moderator
Not sure about the rest of your idea but just for the record:-
If you have N inputs, the total combination (they can be pushed or not pushed, so two possible states) will be 2 raised to the power N (including all off)
So, for seven buttons that would be 128 possible combinations.

Just think it through.
1 = on or off = 2 states
2 = off+off,off+on,on+off,on+on = 4 states
3 = 8 states
4 = 16
5 = 32
6 = 64
7 = 128
8 = 256
...
16 = 65536
 

hippy

Ex-Staff (retired)
Dunno yet.
Perhaps the best thing is to undertake some simpler, quick and easy, projects so you get a feel for what you can achieve and how things work which will set the foundations for more complicated and larger projects.

A flashing light project in itself might not be that compelling as a goal but by doing that you will still be learning and gaining useful experience and confidence. You can build on breadboard and then strip those circuits down ready for the next experiment-come-learning task so you aren't wasting resources nor your time.
 

laserhawk64

Senior Member
How about a simple robot? I'm thinking of a two-stage sort of thing, so that I could learn a bit with the first stage, and then expand on it for the 2nd.

Stage 1 would be a simple object-avoidance robot. Uses three microswitches (the clicky lever-actuated type) to detect obstacles, and two motors (each with a wheel) to move. When an obstacle is detected, it reverses direction on that side's motor briefly, and then resumes forward motion. The third (center) microswitch would short out both inputs (essentially, %11 instead of %10 or %01) and would have a slightly different behavior -- both motors would reverse, then one (chosen randomly) would switch forward before the other (so as to avoid a 'battering ram' sort of phenomenon). This is really not hard to implement, even with the 08M I have -- I *think*.

Stage 2 would be something a bit more complex, inspired by an article I saw in (IIRC) Make: about Machina Speculatrix. (I found that Wiki article in a link from Wikipedia.) Neat stuff! The more advanced machine would be quite fancier, and would likely need a bigger PICAXE -- 14M2 at the least, I think.
- more sophisticated object-avoidance -- four microswitches (two flank, two front). The left flank and left front switches would be electrically connected (and share one input) and the right flank and right front switches would be electrically connected (and share another input). Theoretically, I could stick them all on a shift register and use one input total (and therefore derive four behaviors from it without chewing up four inputs)... but I can't find ANYTHING on the RevEd website about how to interface a PICAXE with a PISO shift register... hmmm. Kinda surprising.
- IR- or RF-guided battery monitoring (?) or brightness monitoring -- when it's time to recharge, or when the lights go out, it uses an IR or RF beacon to find its 'bed' and 'sleeps' until either the battery is full, or the lights come back on.
- 'food' avoidance -- in the case of the battery monitoring bit, it avoids the 'bed' when it's not 'hungry' (in a low batt condition). Alternatively, a mild case of photophobia could be substituted -- it avoids really bright lights (CdS cell, or a phototransistor and some welding-goggle material, would be the sensor here).

Again, to be clear, stage 1 (simple object avoidance and nothing else) would be the first step! Stage 2 would probably be broken down into smaller steps; I'd probably implement the four switches first, then the "mild photophobia" bit while I work out how to mechanically interface it with a charger (the charger itself is not hard to figure out -- SLA batteries with a 14hr trickle-charge setup lend themselves well to simple circuitry!). Only at that point would I build the 'bed' and teach the bot to be hungry (or not).

Am I making sense?
 

westaust55

Moderator
Getting back to the polyphonic organ project . . .
There is no reason why you could not use an ADC input and with around 12 or even 16 keys and some resistors decode the keys via the ADC input – its been done before by many here (think first posts about this were by BCJKiwi).
For output there is the TUNE command (it can do one note at a time) or the SOUND command.
If you search back on this forum, I did ( a few years back) some coding using the SOUND command to emulate an approx octave of notes.


EDIT:
To make life easier for you here is the thread using SOUND to emulate TUNE
http://www.picaxeforum.co.uk/showthread.php?9578
While the destination chip had TUNE available it was still a worthwhile experiment.
 

laserhawk64

Senior Member
OK, going back to that (for now -- final decision not yet made for sure!)...

I was thinking of the "mode" button as able to switch to completely different sound sets, sorta like a very old keyboard I have (it was called the MIRACLE -- one of the first to interface with a PC. yeah, that old...) that has six different "effects". My favorite was Vibraphone (kinda bell-y), but it also had Piano, Electric Piano (really ratty sounding), Organ (didn't stop), and two others that I've forgotten. Aside: that keyboard was built quite well -- it's been around since the early 90s and it still works pretty well, although I'm not sure how the software and cable fared... one of these days, I'll find out. I actually have a computer old enough to read the 720k floppies!

So if I wanted three sound sets... call them Piano, Organ, and Electric Piano, with the following characteristics (below) how would I implement that, or can I?
Piano -- fade out fairly quickly after, say, 2s of the note-button being held down. Max. note duration 4-5s.
Organ -- keep going until the note-button is released, then fade out very quickly. Max. note duration button time plus ~1s.
Electric Piano -- Raspier and more 'lo-fi' sounding than Piano, and fades out like Organ. Max note duration 3-4s.

I'm guessing that I'm asking too much of the SOUND command, but I'd like to have that confirmed. If so, no big -- I have another idea if that's the case.
 

westaust55

Moderator
Sound and Tune are relatively basic functions/commands.
You have no ability to change the “ambience” or instrument type.
You would need to consider one of the external music/audio modules and maybe additional hardware as filters for the sort of implementation you are suggesting. That is another whole field you need to research for yourself.
 

laserhawk64

Senior Member
Screw that, too much money involved. I did mention I'd another idea for the mode button... howzabout having it switch octaves?

Here's what I'm thinking... I'll need some help with this, as it involves a shift register, and RevEd's website doesn't explain how to use that as an input -- I've looked, it's not in the command listing (near as I can find) or in the Circuit Creator page. I'd like to use a 74xx674, but I can't find them for any sort of reasonable price... Mouser wants "twenty five dollars and pieces of silver" (to borrow from Simon & Garfunkel a little...), which is a bit more than highway robbery, and eBay has one seller with a price of $5.75 -- not bad until you realize that they also want $4.95 shipping on top, for Priority Mail! (I've a message into the seller, asking about First Class rates...)

Here's the basic idea. With the '674, 15 buttons (8 buttons with a '166). Button #1 is the mode (octave-shift) button. The others are for notes. When a button is pressed, a note is played until the button is released. (KISS.) Default (first) octave follows the frequencies on this page here. The mode switch, when pressed, toggles a second octave, which would be quite a bit higher. Here's the two sets of 14 notes, in Hz...

Oct 1 -- 0261,0294,0330,0349,0392,0440,0494,0523,0587,0659,0698,0784,0880
Oct 2 -- 0988,1047,1175,1319,1397,1568,1760,1976,2093,2349,2367,2794,3136

Note frequencies for the 2nd octave from here.

In the case of 14 buttons (+ mode button), each button would be a separate note. In the case of 7 buttons (+ mode), each button would correspond to every 2nd note, and when two buttons were held down, it would be the note in between. So (eg) for the first octave, one button might be 261Hz, the next 330Hz, but hold down both for 294Hz. Shouldn't be too hard to implement (famous last words?). I'd ideally like to 'add' notes together (eg combine 3 notes for a totally different sound), but that means a lot of nasty math on the part of the 08M and I'm not sure it's got enough horses for that. All of this of course assumes PWM output (how do I convert Hz to PWM values?)...

With the SOUND command, I could assign notes to buttons and their combinations, but it wouldn't be nearly as precise, I think -- particularly since RevEd doesn't list the frequencies for the notes that SOUND outputs, so I'd have to buy an o-scope (not going to happen) or somehow get the frequencies from elsewhere... ouch.
 

westaust55

Moderator
You can always use the analogue input approach that I have previously mentioned (try a forum search for ADC keypad) or alternatively a 74C922 / 74C923 keypad encoder chip – the 74C922 is available from Futurlec (www.futurlec.com) for about US$8 plus about $4 postage – so get a hand full of bits for the same total postage.

Try a search on this PICAXE forum. I recently gave a formula for the approx frequency of the tones from the SOUND command. There is always the TUNE command with defined/far more accurate notes in three octaves – all covered in the PICAXE manual 2.

Just thinking, you mentioned polyphonic organ earlier. The PICAXE can only do one thing at a time which also includes playing one note at a time so think monophonic for a single PICAXE chip.

Its time for YOU to do some research on the PICAXE capabilities rather than just firing off strings of questions for something which may never come to finality.
Try a forum search with terms such as “organ”, etc.
Here is one thread to get you going: http://www.picaxeforum.co.uk/showthread.php?22028-PICAXE-Synthesiser-project
 

laserhawk64

Senior Member
Got a budget for the robot. US$35-40. Parts will be ~US$32, plus whatever perf I have to buy from Radio Shack. I'll have $40 total on the 15th, so I'll start buying then, I think. Shouldn't be too hard.

I'll post a circuit diagram tomorrow -- it's drawn up, just gotta scan it and all. It's 1am here, so I think I'll go to bed first ;)
 

Paix

Senior Member
@Laserhawk64. Exactly which part of
Its time for YOU to do some research on the PICAXE capabilities rather than just firing off strings of questions for something which may never come to finality.
did you fail to understand?

I can understand your unbounded enthusiasm, but why not think smaller and step up to greater projects in small steps.

Look at the way playing an instrument is taught. One note at a time, consolidate the first few notes in four bars of music. Rinse and repeat. Make the passages slightly longer to build up stamina as understanding is accomplished.

What is it you want your robot to do - exactly? How many different functions does this incorporate as there isn't a Robot function included? :)

Breadboard the different functions, motor driving, line following etc. and then incorporate/integrate them into a larger model that you can polish a bit. Eventually realising that you are close to having said robot or get sufficiently bored and want to move on to a different PICAXE project. Until you focus on one object at a time, then you will be totally distracted and your brain cells will hop around like bunnies in a basket until they finally melt down - honest Pinoccio told me so! :)

Good luck, but slow down and concentrate. I have recently seen a young fella totally wreck a £700 radio because he was unfocussed and didn't take the time to figure out what he did and didn't know. All impulse and unfortunately a few expensive smoking components.

Slow down and consolidate. Just reading the threads of others here will keep you drooling and delay your projects more than you imagine, without thinking up cockamamey configurations of your own every few seconds.

Happy New year by the way. Don't waste your money filling your bits box; save it and spend it carefully. The bits box will eventually just fill it self up almost naturally anyhow.
 

laserhawk64

Senior Member
What I'm thinking of would be...

...a simple object-avoidance robot. Uses three microswitches (the clicky lever-actuated type) to detect obstacles, and two motors (each with a wheel) to move. When an obstacle is detected, it reverses direction on that side's motor briefly, and then resumes forward motion. The third (center) microswitch would short out both inputs (essentially, %11 instead of %10 or %01) and would have a slightly different behavior -- both motors would reverse, then one (chosen randomly) would switch forward before the other (so as to avoid a 'battering ram' sort of phenomenon). This is really not hard to implement, even with the 08M I have -- I *think*.
EDIT: I do admit to being fairly impulsive. Yes, I have lots of ideas -- my imagination is overactive. Always has been. I hope that's not a bad thing...? W/E, I'll try to slow down a bit, as requested :p
 

BeanieBots

Moderator
Stick with the robot idea. (not there's any clue to my bias in my username).
It will far more satisfying and offers much greater scope for expansion as you learn more.
Even for a beginner, it will not take long to produce a fully autonimous robot that fulfill a mission all on its own.
One of the simplest and cheapest is a robot which can avoid objects whilst seeking out the brightest (or darkest) area of a room.
Later you can start to expand by using non-contact object detectors, maybe a flame detector and/or use larger motors for bigger robots etc. etc.
Whatever you decide to do, it is now time to start DOING and stop talking.
Get some bits and start playing with them. Make an LED flash before you do anything else.
 

laserhawk64

Senior Member
I'm sticking with the robot, for sure. The musical instrument, while challenging, wasn't terrifically interesting -- and it was challenging in ways I didn't like anyways. It would not have been able to do what I was wanting.

As soon as I have the money, I will start buying the parts I need for the robot. Once the parts arrive, I will start building and coding. Most of the parts will come from overseas, because it's the only way I can afford to buy them, although I will double-check against Mouser's prices to make sure, before I click "Buy It Now" on eBay.

I have a schematic diagram and a list of components. I've almost finished laying out the perfboards (one for the motor H-bridges, one for the rest). Then I will scan all that in (neater this time than previous -- I'm allowing myself lots of space, rather than trying to be super-compact) and post it here. Wire-routing is quite the pain, but it's both important and (in the end) rewarding.

...I suppose I can bring myself to make an LED blink, as some sort of minor prelude to the real beginning, but I'm rather inclined to skip straight to the robot since its behavior is so appallingly simple. It doesn't really even make much use of the PICAXE. I could almost certainly implement it fairly easily in discrete components -- and it would actually likely be simpler that way since I wouldn't be confined by the number of inputs and outputs on this bloody tiny chip! As it is, the output pins (which control the motors) are using the idea (discussed in another thread) of pseudocharlieplexed optocouplers and tri-state outputs... to make two outputs into the needed four. The code for the three switches promises clumsiness because I've only two inputs to work with -- left and right collision on each of the two pins, center collision shorts both pins (with diodes to prevent a mess).

Here's what I'm thinking, code-wise, for the robot. This is of course pseudocode for now. If I have to init anything, or if there are bugs, it would be good to know that ahead of time!

Code:
MAIN:
IF pin_3 is high ;left collision detect
	THENIF pin_4 is also high ;test for center collision detect
		TOGGLE pin_1,pin_2 ;puts both motors in reverse gear
		PAUSE 1000 ;wait one second
		at random, TOGGLE pin_1 XOR pin_2 ;puts one motor back into forward gear
		PAUSE 250 ;wait 1/4 second
		TOGGLE the motor pin that wasn't already toggled ;puts the other motor into forward gear
	ELSE
		TOGGLE pin_2 ;left motor into reverse gear
		PAUSE 250 ;wait 1/4 second
		TOGGLE pin_2 ;left motor back into forward gear
IF pin_4 is high ;right collision detect
	THENIF pin_3 is also high ;test for center collision detect
		TOGGLE pin_1,pin_2 ;puts both motors in reverse gear
		PAUSE 1000 ;wait one second
		at random, TOGGLE pin_1 XOR pin_2 ;puts one motor back into forward gear
		PAUSE 250 ;wait 1/4 second
		TOGGLE the motor pin that wasn't already toggled ;puts the other motor into forward gear
	ELSE
		TOGGLE pin_1 ;right motor into reverse gear
		PAUSE 250 ;wait 1/4 second
		TOGGLE pin_1 ;right motor back into forward gear
GOTO MAIN
 

russbow

Senior Member
............ or if there are bugs, it would be good to know that ahead of time!
I don't think you ran your code through syntax check to see if you had any bugs did you :(

Maybe look at manual 3 again to sort out input pin detection?
 

westaust55

Moderator
@laserhawk64,

Within the Rev Ed PICAXE programming editor, there is a simulation mode where you can try your actual code.
Using the simulator you can pre test your code and then only need to ask a question when there is something you don't understand or there is a syntax error you cannot debug.

...I suppose I can bring myself to make an LED blink, as some sort of minor prelude to the real beginning, but I'm rather inclined to skip straight to the robot since its behavior is so appallingly simple. It doesn't really even make much use of the PICAXE. I could almost certainly implement it fairly easily in discrete components -- and it would actually likely be simpler that way since I wouldn't be confined by the number of inputs and outputs on this bloody tiny chip!
With your 08M chip where there is only 256 bytes of combined program and EEPROM space, while it may be tiny they are very capable and folks here have squeezed a lot of functionality out of the 5 IO pins and 256 bytes of program space. For example, I have made a small weather station to monitor temp, humidity and light levels and transmit (wirelessly) the information to a remote receiving station. There are many other facinating 08M projects which have been mentioned in the past on this forum and even other websites.


Screw that, too much money involved.
this bloody tiny chip!
you might please consider keeping the tone/language under control. While not four letter words members are generally proud of the family standards here and a few posts with bad language or links to sites/videos with bad language have been deleted in the past
many would think of the 08M as "this amazing tiny chip!" :)

As soon as I have the money, I will start buying the parts I need for the robot. Once the parts arrive, I will start building and coding. Most of the parts will come from overseas, because it's the only way I can afford to buy them, although I will double-check against Mouser's prices to make sure, before I click "Buy It Now" on eBay.
Another alternative for low priced general electronci components is Futurlec. www.futurlec.com.
Sure you might have to wait a couple of weeks to receive the parts but component costs and of postage are typically far better than Element14/Mouser cost plus couriers for delivery.
 

laserhawk64

Senior Member
Apologies for the language -- in the US, 'screw' and 'bloody' are not anywhere near as bad as in eg the UK. (The fact that IRL I tend to sound like a drunken sailor who just tripped over a staircase, doesn't help, lol.) I'll try to be better at that!

That weather station is quite an accomplishment -- I can't imagine how one would do that with a single 08M (ie no secondary PICAXE chips)!

I do get frustrated and impatient very easily. (Something else to work on.) I hope you folks will be patient with me, and I'll try to do the same!

I've heard of Futurlec -- thought they made chips, not sold components. Oops. Very UNimpressed with their website design (at first glance); if I can learn to navigate it, I'll probably be OK. Mouser is really my go-to, though -- I've ordered from them a few times; they're always quite good with what they do -- and if I have a question that they can answer, I know they're only a phone call away. Also, Mouser now has a very convenient Economy Shipping method -- $5 gets one "UPS Innovations" shipping. It's convenient because I know the cost ahead of time.

That said, I'll check out Futurelec's prices (and maybe even that code simulator) tomorrow!
 
Top