Axe023 Motor Driver Board <First time need help please!

Croat_Soldier

New Member
Hi, recently i have purchased the motor driver board. I have connected it up to two motors and two switches. I have no clue about picaxe. Firstly, what mode do i select in the options in the programming editor? Thanks for any help :)
 

westaust55

Moderator
First time help

Welcome to the PICAXE forum.

To program the PICAXE chip you will need to download the Programming Editor from the rev Ed website.
There is a link to the Rev Ed Programming Editor at the right lower side of the orange abr at the top of this forum page or alternatively go to the Reved website at:
http://www.rev-ed.co.uk/picaxe/software.htm

Then download the read the three PICAXE Mnauls. Certainly read Manual 1 as a starting point.
The manuals are available from the top of this forum page -see the orange bar at the top or alternatively from this website page:
http://www.picaxeforum.co.uk/datasheets.htm

Do you have the AXE026 or AXE027 cable.

Maybe some more specific questions from you would be easier for answering.
 
Last edited:

Croat_Soldier

New Member
thanks for the quick reply, very impressive. I am making a tank for a school project. I would like it to drive forward until the 1 of the swiches have activated (2 of them are located on the front of the tank). Once the switch had been pressed i would like it to reverse, turn around and continue its trip. As for the mode i am still confused, i hav the axe027 cable. Thanks
 

hippy

Ex-Staff (retired)
The mode setting will depend on which PICAXE chip you are using. Reading the AXE023.PDF it appears the board is fitted with a PICAXE-08, although a PICAXE-08M can also be fitted; the setting will likely be "08", possibly "08M".

With the mode settings displayed, and the PICAXE connected, clicking the Firmware button should reveal which it is; then alter the selected option to match.

If you have the wrong mode selected when it comes to downloading the Programming Editor will detect this so no damage will be done if it is set incorrectly.
 

hippy

Ex-Staff (retired)
That's a bit like asking, "how do I design and build a car". The first step is knowing exactly what you want to do, then learning how to go about it, plus gaining the skills to do it.

The PICAXE manuals, example code, posts on this forum and PICAXE projects found through Google are the best starting places if learning PICAXE outside of a formal educational environment, and there's arguably no substitute for trying things and learning how things work, building up step by step.

What electronics and programming experience do you have ?
 

Croat_Soldier

New Member
hi hippy, i have written previously what i want it to do. I have a high experience with programming but the variables seem to be different for picaxe. Making it drive, reverse and stop is simple however for the switches how do i use statements like:
If switch.activated Then ........?
 

westaust55

Moderator
IO pin reading and control

To understand more about "reading" and controlling the PICAXE IO pins, based upon the 08/08M have a look at:

1. PIACXE Manual 1 (Rev 6.7) pages 81/82

2. PICAXE Manual 2 (Rev 6.7) pages 75 to 77 and especially the bottom of page 77

3. PICAXE Manual 2 (Rev 6.7) pages 102/103 and althought for the 14M have a look at page 14.

Then there are the HIGH and LOW commands
 

Croat_Soldier

New Member
Almost their

ok so with this example, how would i make it if pin0 OR pin5 = ......

main:
if pin0 = 1 then flsh ‘ jump to flsh if pin0 is high
goto main ‘ else loop back to start

flsh: high 1 ‘ switch on output 1
pause 5000 ‘ wait 5 seconds
low 1 ‘ switch off output 1
goto main ‘ loop back to start

unless i dont need to worry about it since the switches are connected in parallel?
 

Croat_Soldier

New Member
Thanks for the help everyone !

one last question tho:rolleyes::

with this command below, does the pause:
(pause the output 1 and then continues?) or
(the output before stays on and waits 5 sec to coninure nxt command?)

flsh: high 1 ‘ switch on output 1
pause 5000 ‘ wait 5 seconds
 

westaust55

Moderator
one last question tho:rolleyes::

with this command below, does the pause:
(pause the output 1 and then continues?) or
(the output before stays on and waits 5 sec to coninure nxt command?)

flsh: high 1 &#8216; switch on output 1
pause 5000 &#8216; wait 5 seconds
the output (pin 1 in this case) stays on and after waiting 5 sec program continues to the next command :)

Try using the Simulator Mode in the Programming Editor and you can see this for yourself.
 

Croat_Soldier

New Member
ahk, thanks :D
any1 mind jst checking this- have ran it through the simulator without errors. Just checking if i got the right idea?

main:
high 1 'forward motor1
high 4 'forward motor2
if pin3 = 1 Then selfdrive 'jump to selfdrive if pin3 is on
goto main 'else loop back to start


selfdrive:
low 1 'stop motor1
low 4 'stop motor2
high 2 'reverse motor1
high 0 'reverse motor2
pause 2000 'wait 2 seconds
low 2 'stop motor1
low 0 'stop motor2
goto main 'loop back to start
 

westaust55

Moderator
AXE023 Motor controller board

Yes that code will work.

I do note that you have the forward and reverse in your comments opposite those given in the AXE023 datasheet but as long as you have the motors connected the right way you will get the result you want.
 

westaust55

Moderator
By way of example, here is another way of writing the same code using the IF...THEN....ELSE structure which keeps the commands grouped. Uses the same amount of program memory space (25 bytes)

Code:
Main:
IF pin3 = 1 THEN  'run motors in reverse direction
  LOW 1 'stop motor1
  LOW 4 'stop motor2
  HIGH 2 'reverse motor1
  HIGH 0 'reverse motor2
  
ELSE             ' run motos in forward direction 
  LOW 2 'stop motor1
  LOW 0 'stop motor2
  HIGH 1 'forward motor1
  HIGH 4 'forward motor2
ENDIF

PAUSE 2000 'wait 2 seconds
GOTO Main
 

Croat_Soldier

New Member
ok, i have one more concern tho, i have two switches connected to the inputs. However the programming shows a error when i try the If pin3 = 1 OR pin5 =1 statement. Do i need to include the pin5 somehow or will either switch work through the pin3 statement? Btw thanks so much for making this project easier for me, any chancce you have a paypal account? :rolleyes:
 

westaust55

Moderator
An extract from the AXE023 datasheet that might explain things:

Connecting the Input Switch
Only pin3 can be used as an input with the motor driver board, and the input header (H2) below the L293D chip must be in the left hand side position (pin5 cannot be used with the PICAXE-08 system as this is the serial input pin).


However two switches may be connected to the board, one either side as shown below. Note that when switches are connected like this they are connected in parallel, so either
of the switches can be pressed to activate the input.
So your code need only look at pin3 and if either switch operates the motors will change direction

Thanks for the financial offer, but helping those who are willing to help themselves and are willing so say thanks is enought (unless you want 100+ man-hours of programming help :) )
 
Last edited:

Croat_Soldier

New Member
Hi again

I am having a little trouble with my board. When i connect a battery supply (6V 750mAh) the board does not follow my programming. However at school when i used the power supply at 6V it worked fine. Do i need some sort of capacitor at the power input? If so, how can i work out which one?
 

inglewoodpete

Senior Member
6 volts? Don't use 6v on a PICAXE without dropping the voltage to a safe level.

The recommended supply for most PICAXEs is 3 x AA cells (4.5volts). On a bad day 6v could irripairably damage a PICAXE chip. A regulated 5v supply is also safe.
 

hippy

Ex-Staff (retired)
One option is to take the 6V to the motors plus drop the 6V through a diode to the rest of the electronics. Not a perfect solution but it does 'knock the edge off' the 6V, a 0.6V drop brings it to 5.4V which is within recommended operating voltage.
 

westaust55

Moderator
6 volts? Don't use 6v on a PICAXE without dropping the voltage to a safe level.

The recommended supply for most PICAXEs is 3 x AA cells (4.5volts). On a bad day 6v could irripairably damage a PICAXE chip. A regulated 5v supply is also safe.
The problem is that a LOT of the Rev Ed datsheets etc DO make reference to 6V and not 4.5 to 5V. :eek:
 

inglewoodpete

Senior Member
Almost any small silicon diode will do. Common ones in Australia that I would use are 1N914, 1N4148 or EM4001 etc.

A forward biased silicon diode has a 0.5v to 0.6v drop before it starts conducting, so it can remove about half a volt when connected is series with the supply. A reverse biased diode will not pass any current but you already knew that, didn't you? So, if the diode is inserted the wrong way around in this case, the PICAXE will simply not work.
 

Croat_Soldier

New Member
Almost any small silicon diode will do. Common ones in Australia that I would use are 1N914, 1N4148 or EM4001 etc.

A forward biased silicon diode has a 0.5v to 0.6v drop before it starts conducting, so it can remove about half a volt when connected is series with the supply. A reverse biased diode will not pass any current but you already knew that, didn't you? So, if the diode is inserted the wrong way around in this case, the PICAXE will simply not work.
Ohk, thanks a lot :)
So this should work fine?
http://www.jaycar.com.au/productView.asp?ID=ZR1100&keywords=1N914&form=KEYWORD
And yes i do know about the biased diodes. However i was thinking of somehow smoothening the power from the battery since the data sheet says 6V is compatible. But this sounds great. Thanks again
 

Croat_Soldier

New Member
Thanks Everyone- Here the pics as promised.

The army tank i built was made up various subsystems. As u see i decorated it with the guns and camo paint. I fitted in a rollover horn, solar powered lights, a charging socket on the back, a battery voltage indicator and most importantly a fully functional picaxe motor driver board that stops when its upside down. Once again thanks guys ;)





 
Top