Picaxe motor controller

Discussion in 'The Projects Forum' started by Edmunds, Apr 19, 2012.

  1. Edmunds

    Thread Starter Active Member

    Sep 27, 2010
    85
    0
    Hi all,

    Some help needed. I have received the Picaxe project board and I'm quite happy with the little traffic light thing I did in less than 30 minutes after opening the package :).

    However, the real question is, how possible is it to turn 08M2 chip into a motor controller or H bridge. The chip has four output pins and two input pins, so in theory, I should be able to give two signals and have enough outputs to run the motor in both directions. Speed control is not my problem - could solve it otherwise. If it can be solved, however, it would be interesting to keep the space requirement lower.

    Any experience with this?

    Thank you,

    /Edmunds
     
  2. CDRIVE

    Senior Member

    Jul 1, 2008
    2,223
    99
    Actually, the new M2 parts have more inputs than that and the M parts did also. I drew this for another thread but you should be able to take what you need from it. BTW, you can cannibalize H-Bridge chips from old VCRs
     
  3. Edmunds

    Thread Starter Active Member

    Sep 27, 2010
    85
    0
    Hei, thank you for your reply! Very useful.
    However, I'm hitting my space wall again. I tested 08M2 today with a simple 4mm motor - works great. I can set up whatever sequence and direction I want. However, when I connect it to the "real" motor with some load (50mA maybe), it stops working. Seemingly, the "real" motor is drawing too much current and I'm back to square one with transistors, mosfets or what not :).

    From the size perspective, the only thing I can squeeze in together with 08M2 smd version, are probably SMD darlington thingies - analogs of FMMT38A or something.

    I'm confused about how this could work. I mean, I need changing polarities and transistor like things don't do changing. So I need two? One for each pin/direction despite it is the same motor? If it does any good, here is my Picaxe 08M2 code that seems to work as long as there is no load:

    '***********************
    '*08M2 motor driver 1.0*
    '***********************

    symbol MC1 = C.1 'Motor Contact 1
    symbol MC2 = C.2 'Motor Contact 2
    symbol L1 = C.4 'Light on top of the ladder
    symbol IPT1 = C.3 'Input by light3 from DCCar

    'setfreq m16 '4MHz seems no problem for the speeds needed
    output MC1
    output MC2
    output L1
    input IPT1
    low MC1
    low MC2
    low L1

    main:
    if pinC.3 = 1 then 'signal from light3 DCCar exit received
    high MC1 'start to extend the ladder
    high L1 'light on
    pause 5000 'ladder up time in miliseconds
    toggle MC1 'stop extending the ladder
    pause 10000 'fire fighting time in miliseconds
    toggle L1 'light off
    high MC2 'start retracting the ladder
    pause 5000 'ladder down time in miliseconds
    toggle MC2 'stop retracting the ladder
    pause 1 'delay in miliseconds for light3 to go off safely no to initiate the whole thing again
    else
    low MC1 'standby
    low MC2 'standby
    endif
    goto main


    Any input appreciated! Thank you,

    /Edmunds
     
  4. CDRIVE

    Senior Member

    Jul 1, 2008
    2,223
    99
    Another approach.

    [​IMG]
     
  5. nerdegutta

    Moderator

    Dec 15, 2009
    2,517
    785
  6. Edmunds

    Thread Starter Active Member

    Sep 27, 2010
    85
    0
    Thanks,

    That would do as well. My challenge is to find the most space saving solution. I have 9x5x2 mm for all the components with all the wires. The worst case, of course, is to split the components up and keep some of them elsewhere, but that means many extra wires to the moving part - not good.

    This is the thing I'm trying to automate now - http://youtu.be/S28mgAn2-aQ

    It needs to lift, turn and extend the ladder by running the motor in one direction, then wait for some time that I need to be able to adjust and then do the opposite by turning the motor into the other direction.

    /Edmunds
     
  7. Edmunds

    Thread Starter Active Member

    Sep 27, 2010
    85
    0
    Last edited: Apr 22, 2012
  8. CDRIVE

    Senior Member

    Jul 1, 2008
    2,223
    99
    That FET package alone won't solve your problem.

    There's an H-Bridge chip that's been discussed here before. I suggest you search the forum for it. BTW, very few devices are suitable to be directly driven from a pic, especially motors. Unless specs have changed, the Picaxe isn't designed to source 50mA on any of its pins.
     
  9. Edmunds

    Thread Starter Active Member

    Sep 27, 2010
    85
    0
    Hi,

    Thank you for your input. Picaxe chips can do 25mA per pin, I think. That does not work for a motor, of course. Or most motors.

    Here is a copy from Picaxe manual, that to my mind says "that FET package" might well work:

    Standard Circuits 4 - The Power MOSFET Interfacing Circuit

    Power MOSFETs can be used instead of darlington transistor pairs to switch medium power devices. The standard MOSFET circuit is shown below. The device IRL520 is a suitable logic level MOSFET to use in this circuit.
    Note that it is usual to connect a back emf suppression diode across the output device. This is essential with devices such as relays, solenoids and motors which create a back emf when power is switched off. The diode type 1N4001 is the device recommended.
    When a PICAXE chip resets the output pin is momentarily not directly driven. Therefore on sensitive circuits it may be necessary to include a 10k pulldown resistor on the MOSFET gate. This holds the gate off until the PICAXE actively drives the output.

    
    Isn't the 2N7002DW the same thing, just two in one with the diodes included?


    Thank you,

    /Edmunds
     
  10. CDRIVE

    Senior Member

    Jul 1, 2008
    2,223
    99
    The problem is that you want to reverse the motor as well. This requires an H-Bridge or Relay switcher circuit, both of which I posted. To replicate an H-Bridge in FET form you will need both N-Channel & P-Channel FETs. This arrangement closely replicates the NPN-PNP BJT versions of the H-Bridge.

    Why are you so insistent on not using the available chips made for this? You have severe space limitations, which I would think ICs would be better suited to satisfy.
     
  11. Edmunds

    Thread Starter Active Member

    Sep 27, 2010
    85
    0
    Hi,

    I do insist on the smallest possible solution, not the straight forward one, out of the box. The two do not have to contradict, I'm just asking questions to make sure :).

    One item I have found so far is this: http://www.freescale.com/files/analog/doc/data_sheet/MPC17510.pdf

    It is not small by my standards and it has a lot of features I have no use for. On top of that, it requires like 5 extra components to work. If this will turn out to be the smallest thing that works, I will have to figure out how to fit it in. I'm having hard time to believe, there is no smd H-bridge with 6 or max 8 legs, since this is how much one actually needs for simple applications.

    There is another one like this: http://www.allegromicro.com/en/Produ.../3950/3950.pdf

    This is much smaller and looks much better by all means, but I have not been able to find a retailer selling it.

    Am I looking in the wrong place or something? Any other products that come to mind?


    Thank you,

    /Edmunds
     
  12. CDRIVE

    Senior Member

    Jul 1, 2008
    2,223
    99
Loading...