A little electronics help

LeonR

Member
Hi , this is my first post and reading through the forum it looks like a nice friendly community!


I knew roughly how simple robots and basic AI worked, but i've always lacked skills in electronics (I can program fine in various languages).
Recently I stumbled across various controllers and then found a link to the PICAXE's. From a logical point of view they look amazing and an absolute dream asfar as built in functions and IO goes! Plus the modules you can add look awesome, and the best bit is the price, I was really impressed.

All of this has tempted me to try and build a robot! I will most likely use technic lego, as the gears, axles, motors etc are all there and everything fits together with no glue etc etc.


Before I get started I need to get up to scratch with my electronics skills though. I'm assuming you cant simply attach a motor to the output pins of a PICAXE board (28 version?), so can I use a transistor to do this? and would it work with pulsing, so that the motors speed can be controlled?




Excuse my pants diagram, but its just rough. If I can understand these basics (and they are basic) I think I can work the rest out.

I have a feeling I have got the negative and positive the wrong way! :( Or the entire circuit, lol

Thanks!!
 
Last edited:

eclectic

Moderator
Leon.

I suggest that you download the Editor.
Inside the "package", you'll find Manual 3.
(Alternatively, see the "Datasheets" option above.)

There are some excellent little "tutorials" there,
for example, motors, starting at page 12.

e

Added. This is a superb introduction to electronics.
Well worth a browse.

http://www.kpsec.freeuk.com/
 
Last edited:

LeonR

Member
Ok cool!

Cheers!


I did have a quick look just now in the "read first" thread, but somtimes its easier to be told whats happening, rather than just stare at a diagram and try and guess.

I will have a look!
 

Andrew Cowan

Senior Member
If you use a project board that has a darlington driver (two transistors) (eg ULN2003), then you can just connect a motor (ne direction only). For two directions, you need a LM239. Some boards have an option for higher voltages as well.

I recommend you buy the axe020: this has:
Support for an L239 motor driver (so you can reverse motors)
Support for high voltages for the motors
all the interface and connections you need.

The L239 has 38V max, and 600ma max. It will control 2 motors. The L298 is 2A max, 40V max.

Andrew
 
Last edited:

marcos.placona

Senior Member
ULN2003 won't let you run a motor reverse and forwards by itself. You'd need a motor driver chip (such as LM293 or 298 depending on the motor) or an h-bridge (doesn't pay for all the hassle in building it)
 

LeonR

Member
If you use a project board that has a darlington driver (two transistors) (eg ULN2003), then you can just connect a motor. Some boards have an option for higher voltages as well.

I recommend you buy the axe020: this has:
Support for an L239 motor driver (so you can reverse motors)
Support for high voltages for the motors
all the interface and connections you need.

Andrew
:)

Is the 28x1 also capabale of what the 020 does?
I just checked the datasheet and it looks ok for this?

Thanks for the help, I appreciate it!


EDIT:- I was looking at the start kit code! My mistake!

When it says "support for" does this mean it already has the driver chip onboard? As I see theres also a motor driver PCB avaliable with 4 outputs and with its own microchip. I assume this is not related to what I want to do? (sorry just trying to make a few important points clear in my head).

Cheers!
 
Last edited:

Andrew Cowan

Senior Member
It means there is a socket for a L239D chip soldered on the board, but the L239D driver microchip is not included in the axe020 kit. If you want to drive a motor, you need to purchase it separatly (about £2). Any 28 pin PICAXE can be inserted in the axe020.

The motor driver PCB is unrelated - it is just an 8 pin PICAXE connected to a L239D. If you only need one input and no other outputs, then that PCB would be fine.

Andrew
 

LeonR

Member
It means there is a socket for a L239D chip soldered on the board, but the L239D driver microchip is not included in the axe020 kit. If you want to drive a motor, you need to purchase it separatly (about £2). Any 28 pin PICAXE can be inserted in the axe020.

The motor driver PCB is unrelated - it is just an 8 pin PICAXE connected to a L239D. If you only need one input and no other outputs, then that PCB would be fine.

Andrew

Thats great! That made it much clearer :)

What you said is how I assumed it worked, but I wasn't 100%.

I just ordered some bits and bobs, the axe020, 28x1 and L239D + cable, some LED's and essentials.

I will see if I can get a few simple things working first, then I will progress on to attaching the motors (when i find some 9v lego ones), then once my robot 'base' moves around ok, I will maybe start to look into some more advanced sensors such as a rangesensor mounted on a servo (looking at other robot ideas, that seems popular).

I will probably blow up the chip before I even connect it! :eek:


Thanks for the help!! :D
 

Andrew Cowan

Senior Member
Have fun! As long as you don't connect the chip to more than 5V, there is not too much you can do to blow it up.

Let us know how it goes once the bits arrive.

Andrew
 

LeonR

Member
:D Ok the parts arrived!

I pretty much got it all connected up and got some code running lighting an LED using 1 output etc, that worked fine.

Interestingly, I then tried it with a 2nd LED, alternating between the two (that was the plan), but only one LED stayed lit, so I reset it, then nothing would download to the picaxe which confused me. I rebooted the PC thinking maybe the com IO was confused... no go.. tried about 5 more resets, hard power resets etc and it still failed... I then twisted the com cable, power reset, held reset etc, then it just started working again! So im not sure what that was all about...

The second part which confused me was wiring up an LDR to an analogue input. This seemed simple, I thought I will simply connect it between +V and the analogue input pin. This got a reading of 255, so I figured there needs to be a resistor (looked at the example), and the resistor needs to be between the LDR 0v(analogue input) and GND.

Why can't I just put the resistor between the LDR and 0v (input pin), such as v+ >>> LDR >>> Resistor >>> 0v input pin ??

And my last question :p , using the darlington chip (which comes on my axe020), I assume the output ports are negative and not positive? So you need to wire the output circuits the otherway around?


Im slowly getting there!


Thanks! :)
 

Texy

Senior Member
LDR = light dependant resistor - its resistive value changes with the amount of light it can 'see'. By connecting it up as a potetial divider, the voltake at the mid point changes with light. So the correct connection should be

+V.....LDR....Picaxe pin....resistor.....0Volts

Note that the Picaxe pin must be connected to both the LDR and the resistor.

The problem with the the comm is one I have also seen - probably just a bad connection, usually solved by disconnecting and re-inserting the 3.5mm jack plug.

Texy
 

Dippy

Moderator
LDR: Yes res down to ground. LDR forms part of a potential divider. Look at PAGE 28 of MANUAL 3. Save a copy on you PC for future reference. Many questions asked on-Forum are covered in the Manuals.

The Darlington chip: yes, it is low-side driver. So, generally, you connect +ve --Load--- Darlington 'output'. And yes, calling it an Output does sound daft but there are good reasons believe it or not. Again there is some info in Manual 3. Maybe there should be more....?
 

Michael 2727

Senior Member
Re: The LDR question, have a read of this thread -
http://www.picaxeforum.co.uk/showthread.php?t=9923

Also have a read up on voltage dividers-
selected at randon off the net.
http://www.doctronics.co.uk/voltage.htm

R1 =10K + R2 =10K = 1/2 the supply voltage at the junction, 50% / 50%
R1 =8K + R2 =2K = 4/5 the supply voltage at the junction, 80% / 20%
R1 =2K + R2 =8K = 1/5 the supply voltage at the junction, 20% / 80%
R1 =3K3 + R2 =6K6 = 1/3 the supply voltage at the junction, 30% / 60%
R1 = other end to POS.
R2= other end to NEG.
The larger value resistor has the most voltage across it.

Also remember that the total resistance between pos and neg
will determine how much current flows through them e.g.
1k + 1k will waste more power than 100k + 100k, they will both produce
1/2 the supply voltage at their junctions.
 

LeonR

Member
Ok thanks for the info guys!

Much appreciated! I will save the manuals for future reference as suggested and read the links given!


Thanks again!!
 
Top