HobbyKing.com New Products Flash Sale
Reply
Thread Tools
Old Feb 22, 2013, 03:00 AM
Registered User
Scottish Borders
Joined Mar 2006
582 Posts
Must See Video

Someone on another forum asked for a small micro to replace some logic.
I suggested using the tiny ready made Picaxe Surface Mount 08M module and included a link.

But I failed to mention the Must See Video in that link.
So the module is tiny, includes a download socket and 0.1" pins to fit servo leads but the video really shows what it can do.

Its the wackiest human type walking robot I have seen and amazing that it can be controlled by a such a small module.
The hip swinging, foot scuffling introduction is enchanting but the Picaxe servo centring program at 3.29 is classic.

Dave

http://www.picaxe.com/Hardware/PICAX...E-08M2-Module/
orraman is online now Find More Posts by orraman
Reply With Quote
Sign up now
to remove ads between posts
Old Feb 22, 2013, 06:09 PM
Registered User
Scottish Borders
Joined Mar 2006
582 Posts
Is anyone using the Simulator to watch these programs in operation?

In line comments are "A good thing" but scrunching them all to the left so that they fit into the Editor screen is very hard for me and trying to keep them succinct but without loosing the essential information is not easy if one has difficulties with words. Comments that stream off away past the right of the Editor's screen are not only lost but can cause problems. It would be MUCH easier to put a solid block of blurb like this at the top of the page so ~~

Is anyone using the Simulator to watch these programs in operation?

The delay of 400ms is suitable for the simulator in the Free Picaxe Programming Editor, but not much use on a winch

Dave


'Radio Control Simplistic Unipolar Stepper driver.
'To step ahead; maintain position, or step astern
'Dirs, at start-up all pins are input for safety, in some cases
'it is necessary to inform the compiler of the Direction
'input (0) or output (1) in the dirs statement But note
'GPIO3 pin4 is always input and GPIO0 pin7 is always output
'So the third digit from the right in dirs% is ignored
'But is correctly shown as 0 in the simulator.
'Working on Futaba radio. Using TIP121 transistors

#picaxe 08M '.......informs the compiler of model of Picaxe
symbol stepp=b2 '...Give a recognisable name to a variable
symbol delay=b3 '...Another name

delay = 400 '.......400ms, reduce this number to step faster
let dirs = %00011111 '...see above

start:
pulsin 3,1,stepp 'From RC receiver into b2
If stepp <90 or stepp > 220 then start ' out of range trap
if stepp < 140 then astern 'selective jump or drop through
if stepp > 160 then ahead 'jump or drop through

pins = %0 'stick must be centred= all pins input=no power
goto start

ahead:
pins = %00010010 '}4__1 high so with the centre tap wires
pause delay ' }to a separate batt+ so current through
pins = %00010001 '}transistors flows to commoned ground
pause delay
pins = %00000101 '}2_0, note these are GPIO numbers
pause delay
pins = %00000110 '}2_1
pause delay
goto start

astern:
pins = %00000110
pause delay
pins = %00000101
pause delay
pins = %00010001
pause delay
pins = %00010010
pause delay
goto start
orraman is online now Find More Posts by orraman
Last edited by orraman; Feb 22, 2013 at 06:10 PM. Reason: dd
Reply With Quote
Old Feb 24, 2013, 10:07 AM
Registered User
Scottish Borders
Joined Mar 2006
582 Posts
Latching relays are available with single or double coils that can be energised by a short pulse and the contacts will remain in that state even when the power is removed or until a new pulse reverses the magnetic path.
Single coil relays require the current flow to be reversed each time the relay is to toggle.
Double coil relays require the current to flow in the same direction one coil at a time but in the coil associated with the contact requirement.

Double coil latching relays need 2 outputs on the Picaxe and because the maximum current capability of a Picaxe pin is restricted to 25mA and their relatively high current, such relays need drivers such as a 2N7000 on 2 pins.

Single coil latching relays need a special form of driving so that the current flow through the coil in either direction and this normally is an H Bridge circuit.

Picaxe pins are a form of tri state output and can be declared input or output by Dirs%....instruction but only used for binary, a simple Output (pin) or Input (pin) works in the same way.

For Picaxe, Output puts the pin in a state where current will folow in the direction demanded.

But this (output) which when a pin is instructed to be 'High' it will cause current can flow out through a load to ground but if while declared output in Dirs%...and it is not High it will sink current to ground.

So an LED connected between GPIO2,pin5 and ground will be lit by the instruction ... High 2 ...
While GPIO2,pin5 has been set as output but is not forced High by an instruction an LED connected between positive supply voltage and GPIO2,pin5 will be lit by the 'sink current flowing to ground.
The instruction Low has the same effect but is usually used to remove an existing High from a pin.

When a pin is an input it is in a high impedance state ready to receive an input without taking appreciable current.

The AL5WN-K is a miniature double pole double throw single coil latching relay with an unusually low current requirement and a maximum switching capability of 2A which can be connected between GPIO2,pin5 and GPIO1,pin6. Available from ebay international sellers. Even tight me bought some, link saved photography.

High 1 '....will set the relay in one direction with current flowing to ground through GPIO2,pin5
Low 1 '....will remove power from the relay and leave it in that position
High 2 '....will set the relay in the other direction with current flowing to ground through GPIO1,pin6


Dave

Photo showing the AL5WN-K pin arrangement and discussion
http://www.electro-tech-online.com/g...ing-relay.html

A good intro to relay driving with simple schematic.
http://www.w9xt.com/page_microdesign...switching.html

H Bridge, picture of L298N which can be bought on a board with All the diodes, screw down connectors etc. for <5 go to it.
http://en.wikipedia.org/wiki/H_bridge

A world of hurt, Tri State Logic
https://docs.google.com/viewer?a=v&q...nxHU9W-0Yk_3Pw
orraman is online now Find More Posts by orraman
Last edited by orraman; Feb 24, 2013 at 06:13 PM. Reason: dd
Reply With Quote
Old Feb 25, 2013, 05:27 AM
Registered User
Scottish Borders
Joined Mar 2006
582 Posts
Blutoh?

Having screwed up badly, showing ignorance of I2C, I thought it time to search for information only to find ~

PICAXE Raspberry Pi ADC.........in a link below.

In a circular fashion the Instructable (which I quote below) has a comment that includes a link to the Picaxe forum which gives more information and then links back to the Instructable.

If you follow the link to the very friendly Picaxe Forum you may find interesting posts with advanced applications.

But again I must stress that the information on the Picaxe site must be comprehensive and the list of Basic Commands is long but only a score are needed for our use.

MY LIST

debug
eeprom
for-next
gosub
goto
high
if ~choose
let dirs
let pins
low
pause
pulsin
pulsout
pwmout
read
readadc10
return
servo
symbol
toggle
write

You could check what they all do in Manual2 (below) and see if you would need more.

Dave

[Quote
PICAXE is a line of cheap microcontrollers, designed to be easy to use for school children. This means they are easy to use, and you may have one lying in a draw. This instructable will show you how to use one as an ADC, but by writing values to it, you could conceivably use one as a port expander at the same time.



http://www.instructables.com/id/PICA...pberry-Pi-ADC/

http://www.picaxeforum.co.uk/showthr...t=raspberry+pi

http://www.picaxe.com/docs/picaxe_manual2.pdf
orraman is online now Find More Posts by orraman
Reply With Quote
Old Feb 25, 2013, 08:57 AM
---o-O-o---
blutoh's Avatar
United States, NJ, Livingston
Joined Mar 2012
1,604 Posts
Hi Dave,

Good article. I'm impressed that you can setup a 4 channel ADC circuit with only 13 lines of code on the PICAXE! I went trhu the manual, and PICAXE handles Serial, SPI and I2C, so it's very flexible. There is also a seperate i2c Tutorial sheet available. This opens up a lot of possibilities.

Thanks,
Pete
blutoh is offline Find More Posts by blutoh
Reply With Quote
Old Feb 25, 2013, 02:21 PM
Registered User
Scottish Borders
Joined Mar 2006
582 Posts
Pete,
Glad that you found it interesting, do I take it that mentioning that tutorial was a subtle hint?
I had been coming to the idea that only visitors were reading this thread and even they are not commenting.

There are more interesting programs on that site.
A Picaxe unipolar stepper program working by serial input and a similar one for bipolar.

I have copied them into the Picaxe Programmingeditor and have added ~~

let dirsb = %11111111 to get the pins illuminating in the simulator.
Also changed "outbyte" to "oot" to get things going.

Dave

Addendum

Pete,
Just read your kind comments in the other thread and considering my mini gripe about comments now eat humble pie.

Dave
orraman is online now Find More Posts by orraman
Last edited by orraman; Feb 25, 2013 at 02:39 PM. Reason: And that put his gas at a peep.
Reply With Quote
Old Feb 26, 2013, 08:19 AM
Registered User
Scottish Borders
Joined Mar 2006
582 Posts
A First Class site

Jolie Brise.
French gaff rigged Pilot Cutter.
Tall Ships 2000 Winner. Last Sailing Ship to carry Royal Mail.
History section is well worth a visit for sailors and romantics.


First class Picaxe tutorial.

Start by scrolling down to the pictures.
Worth thousands of my words.

The diagrams and photos illustrate perfectly the 'mechanics' of output pins that I recently struggled to convey in words.

Usage of Breadboards.

I am not in agreement with shoving square 0.1 header pins into spring contact breadboards, yes everyone does it including the Picaxe adaptor. But I know of others who have had intermittent contacts on the points where they have been used. And I abhor intermittents.

These square pins measure 0.034" with my 1884 Brown & Sharp vernier micrometer, turned pin IC sockets measure 0.0209", yes I said I was old.
For many years I have been recovering these socket/pins for use as sockets for single strand hook-up wire and insertion into PCBs as 3 way socket/track/pin connections.
I see no point in taking up contact points on a breadboard with standard download socket, download resistors and bypass capacitor when a small board can hold them And the 8pin micro And still have access to all contact points.

A dill (dual in line) micro is normally placed in the centre of the breadboard spanning the clear channel with programming points around and the experiment beyond that.
Rather, build the experimental circuit, get the program working then plug the 'sideboard' into project board or unplug the programmed micro.

Microchip GPIO(pin) designation is more convenient than using the conventional chip (pin) because if the program needs more pins a bigger Picaxe will still have GPIOs but they will be on different pins layouts.

Picaxe 08M2 will accept ~~

high 2
high b.2
high c.2
readadc c.2,b1

Provided that care is taken with fixed IO this means a strait swop for a 14M2, more functions or 18M2 more pins.

I have a spare bare board for the dill version and should anyone fancy it and care to post here, baring the vagaries of the Post Office I will be happy to send it.
Make that a contentious post and I will toss in the sm Rs + C. Big deal, worth 0.03.

Dave

http://www.joliebrisemodels.co.uk/index.html

Picaxe Breadboard Adapter
http://www.picaxe.com/docs/axe029.pdf
orraman is online now Find More Posts by orraman
Last edited by orraman; Feb 26, 2013 at 08:23 AM. Reason: dd
Reply With Quote
Old Feb 26, 2013, 09:05 AM
---o-O-o---
blutoh's Avatar
United States, NJ, Livingston
Joined Mar 2012
1,604 Posts
Quote:
Originally Posted by orraman View Post
.........Just read your kind comments in the other thread and considering my mini gripe about comments now eat humble pie.
Dave, is that like haggis?

Good tutorial on the Jolie site, and a great job on the model!

Pete
blutoh is offline Find More Posts by blutoh
Reply With Quote
Old Feb 26, 2013, 03:41 PM
Registered User
Scottish Borders
Joined Mar 2006
582 Posts
Pete,
Wheesht man! they're no ta be mentioned in sic a like place...................

But looking again at the Jolie Brise Picaxe section, almost half way down there is Mechanical switch program.

Flowchart on the left and the equivalent Basic program on the right.

For those who find things easier with this type of visual programming then the good news is that it is already part of the Programming Editor.
Indeed clicking on the Flowchart button brings down a message that it has been superseded by the more advanced Logicator software with download option but clicking OK opens the original Flowchart.

All the programs copy and paste into the Editor and pass OK on the F4 test key.

It is the Second Photograph down and the schematic above with both the red and green LEDs that would display the Bi-directional flow of current at the pin.

So I am not the only one to leave junk on the board, the yellow and green wires are there to make sure everyone is paying attention.

Dave
orraman is online now Find More Posts by orraman
Reply With Quote
Old Feb 26, 2013, 05:39 PM
---o-O-o---
blutoh's Avatar
United States, NJ, Livingston
Joined Mar 2012
1,604 Posts
Dave,

Is it necessary to buy the PICAXE USB Download Cable, or can someone scracth make the cable?

EDIT: Nevermind, I see now there is a chip inside the moulded cable housing.

Pete
blutoh is offline Find More Posts by blutoh
Last edited by blutoh; Feb 26, 2013 at 06:33 PM.
Reply With Quote
Old Feb 27, 2013, 03:30 AM
Registered User
Scottish Borders
Joined Mar 2006
582 Posts
Pete and All,

Originally there was only a standard RS232 (+/-12v) serial to 3pin cable, still viable but only home made, as above photo in Post #22.

Next there was a serial download cable, 9pin to 3pin stereo.

Next was the USB to serial that accepted to the 9pin serial to stereo cable.

The present recommendation is for the USB to 3pin stereo it has the advantage of being TTL (5v), better for Readadc10, no special circuit required.

Apparently some USB to serial adaptors do not implement a function that is used by Picaxe but some cheap ones do.

Dave

On another forum someone else posted (2.15) ~~
I bought a couple of these USB-RS232 cables a while back and they can program a Picaxe fine:
http://www.ebay.co.uk/itm/270725121950

SparkFun USB Programmer for PICAXE $14.95 Plus your own USB cable and Male 3.5 to male 3.5 cable.
https://www.sparkfun.com/products/9260

http://www.techsupplies.co.uk/epages...CablesComputer
orraman is online now Find More Posts by orraman
Last edited by orraman; Feb 27, 2013 at 06:14 AM. Reason: dd
Reply With Quote
Old Feb 27, 2013, 01:39 PM
Registered User
Scottish Borders
Joined Mar 2006
582 Posts
Cheap USB to Serial Download.

Some months ago this question came up, again.
There appears to be two types available and opinions suggest that the Blue ones worked and the lighter green/blue did not.

I decided to see for myself and splashed out for a blueish one from overseas, cheaper you see.
Well I gave up on home computing after CPM operating system was overtaken and I failed to get the thing going on the laptop.
Today my daughter and son-in-law came to visit and he got lumbered with 'helping' me to get it going.

And it works.

start:
readadc 2,b2 '....Potentiometer, twiddle and watch numbers
pause 500 '.......delay 1/2 second
debug '..............Display value on laptop
goto start

The purchase has timed out on myebay so I don't know which one exactly but it looks like the first link above.
I would make sure that you get the cd with the driver software.

Dave
orraman is online now Find More Posts by orraman
Reply With Quote
Old Feb 28, 2013, 02:06 PM
Registered User
Scottish Borders
Joined Mar 2006
582 Posts
More on Picaxe Download.

I believe the original Picaxe download was Molex type, 2pin 0.1" plugs and sockets before changing to 3.5 stereo, to suit their educational market.
Well it was Molex I used, then and sometimes now, it's easier for stripboard.

The 3.5 plug is convenient, fast, I can't put it in the wrong way and is easy to add to a 9pin serial socket for the cheap USB to serial cable.

The photo shows another sm 08M, this is the vertical pin version ready to plug into the cheap USB cable.
The inline 3.5mm socket can couple through the Molex plug and socket to mini probe clips, it only takes a short length of wire for these to program.

Dave
orraman is online now Find More Posts by orraman
Reply With Quote
Old Mar 01, 2013, 01:55 PM
Registered User
Scottish Borders
Joined Mar 2006
582 Posts
Picaxe Guided Trans-Atlantic Boat

There are more interesting links on this site than I have seen before.

But do look at the History link at the bottom.
No pretentions, humorous, informative.

Dave




Robin Lovelock,

Our autopilot picaxe software has a feedback loop lasting about 6 seconds:
1) use SERIN to read data from the GPS including lat/lon, direction, speed.
2) read direction from wind direction sensor and convert to absolute direction.
3) test if lat/lon in a waypoint box, or other values, and change the destination lat/lon if needed.
4) calculate the target heading from GPS lat/lon to the destination lat/lon.
5) modify this target heading if it means sailing too close to the wind.
6) calculate the error in heading between target heading and real GPS heading.
7) move the rudder servo to steer the boat.
go back to step 1 above.


Picaxe Guided Trans-Atlantic Boat
http://www.gpss.force9.co.uk/autop.htm

History
Snoopy Sloop, the robot boat, from Team-Joker (9 min 21 sec)
orraman is online now Find More Posts by orraman
Reply With Quote
Old Mar 01, 2013, 02:24 PM
---o-O-o---
blutoh's Avatar
United States, NJ, Livingston
Joined Mar 2012
1,604 Posts
This one seems less complex that the FishPi vessel. It's going to be interesting to see which works better. I think minimalism will win over complexity in this case, there is less to go wrong.

Pete
blutoh is offline Find More Posts by blutoh
Reply With Quote
Reply


Thread Tools

Similar Threads
Category Thread Thread Starter Forum Replies Last Post
Discussion Help, S.O.S., ..._ _ _... (and introduction) sajosa Electric Plane Talk 15 Feb 28, 2013 03:00 AM
Discussion How to wire an ESC to picaxe. keffa12 DIY Electronics 9 Apr 02, 2011 11:44 AM
Brushless Motors -- An Introduction... rc_ron Power Systems 1 Aug 06, 2004 01:18 PM
Suggest an introduction ducted jet ARF? bwaltz Electric Ducted Fan Jet Talk 2 Aug 23, 2002 08:50 PM