Shop OBEX P1 Docs P2 Docs Learn Events
PWM output from a Basic Stamp to power a battery to charge it — Parallax Forums

PWM output from a Basic Stamp to power a battery to charge it

sam_sam_samsam_sam_sam Posts: 2,286
edited 2010-12-29 12:42 in General Discussion
What set up would I need as a starting point Just to see if it can be done as far as writing the code for the Basic Stamp

I want to built a PWM circuit type output to control battery charging with an ADC chip watching the Battery Voltage

I am going to use a MAX186 ADC chip

I saw the post Balance Charger Design Idea which got me thinking about this again
this time I what to take it further and try something my self

Comments

  • FranklinFranklin Posts: 4,747
    edited 2010-12-23 21:37
    Not sure what your question is but you will need a mosfet/transistor and a power supply with an output voltage larger than the battery you are charging.
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2010-12-23 22:18
    You want us to provide a starting point - divide what you want to between software and hardware. If you want us to kick around ideas about both, it may never get resolved.

    It would certainly help to know what kind of battery, what voltage, and what capacity you are looking at.

    As you well know, the Forum gets a lot of 'What's the best....?' questions when there is really no best solution without a very precise context for design.
  • sam_sam_samsam_sam_sam Posts: 2,286
    edited 2010-12-24 07:07
    I am really asking more about hardware end mostly what would be the best set up for mosfet / transistor and why ? software end I will work on
    This is the most important part for now
    Ni cads battery's at max of 7 amp hour
    Ni MH battery's at max of 4 amp hour

    Li po pack battery' battery's will be done later how ever I want to keep this in circuit type output lay out to use this later
  • sam_sam_samsam_sam_sam Posts: 2,286
    edited 2010-12-24 14:02
    Franklin

    Thanks for posting this Link I am going to try the circuit where the LM317 and the BC548 and the 1N5404 are and see how this works

    http://www.angelfire.com/electronic/hayles/charge1.html

    I have to wait until I order some BC548 and the 1N5404 I do not have any right now But I will post what happen with my testing
  • sam_sam_samsam_sam_sam Posts: 2,286
    edited 2010-12-28 15:29
    There is no mistake in the wiring diagram part for LM317 In the author write up about how the micro controls it should have one 1N5004 diode I am posting this just in case some one want to built one

    I built the LM317 proto board part today to see if this work or not which it dose work

    I did not look a data sheet for this 1N5004 diode it has a voltage drop of 1.2 volts

    I did not have one so I used a 1N4001 which has a voltage drop of .6 volts which I need two to get a 1.2 voltage drop

    Here is the data sheet..... http://media.digikey.com/pdf/Data%20Sheets/Fairchild%20PDFs/1N5400.pdf


    My mistake
    1024 x 709 - 59K
  • Mike GMike G Posts: 2,702
    edited 2010-12-28 16:02
    Are you sure? The IN5404 is a Zener.
  • sam_sam_samsam_sam_sam Posts: 2,286
    edited 2010-12-29 06:16
    No it is a rectifier diode that can handle 3 amps with a voltage drop of 1.2 volts

    Here is the data sheet .... http://media.digikey.com/pdf/Data%20Sheets/Fairchild%20PDFs/1N5400.pdf
  • Mike GMike G Posts: 2,702
    edited 2010-12-29 06:27
    Gotcha Thanks
  • sam_sam_samsam_sam_sam Posts: 2,286
    edited 2010-12-29 12:39
    ' {$STAMP BS2}
    ' {$PBASIC 2.5}
    '
    '
    '
    [ Program Description ]
    '
    ' Purpose....PWM cycles to see their effect on a LM317T regulator using a 2N3904 transistor and two set of 2N4004 rectifier diode instead of a 1N5004 .
    ' Author.....sam_sam_sam
    ' E-mail..... sam1030@comcast.net
    ' Started.... 12-29-10
    ' Updated....
    '
    ' Parts use LM317T, 2 @ 1.8 ohms resister, 2N3904 transistor to do this test
    '
    ' On the base of 2N3904 transistor to the Basic Stamp Pin I used a 470 ohm resister instead of a 1k ohm resister
    '
    ' With full ON is set a 370 milliamps by default
    '
    '
    [ Variables ]
    '
    laps VAR Word
    '
    '
    '
    [ Program Code ]
    '
    DO
    'GOSUB Full_OFF
    'GOSUB millamp_C_10
    GOSUB millamp_C_120
    'GOSUB Full_ON
    LOOP



    '
    [ Subroutines ]
    '
    '
    'These are the commands for full ON and full OFF
    '
    Full_ON: ' Charging at 370 milliamps
    DO
    FOR laps = 0 TO 1000 ' The for and next is used to keep the from switching from high to Low on the LM317
    PWM 0, 0, 0 '(PWM Pin ,Duty, Duration) (Pin 0, Duty = 0, Duration = 0) = Full ON

    NEXT
    LOOP

    Full_OFF: ' Full OFF still charges a very little with 12 volts INPUT with no load 3.14 volt
    DO
    FOR laps = 0 TO 1000 ' The for and next is used to keep the from switching from high to Low on the LM317
    PWM 0, 255, 255 '(PWM Pin ,Duty, Duration) (Pin 0, Duty = 255, Duration = 255) = Full OFF

    NEXT
    LOOP

    millamp_C_10: ' 10 mill-amp charge rate
    DO
    FOR laps = 0 TO 1000 ' The for and next is used to keep the from switching from high to Low on the LM317
    PWM 0, 255, 40 '(PWM Pin ,Duty, Duration) (Pin 0, Duty = 255, Duration = 40) = 10 millamp charge rate

    NEXT
    LOOP

    millamp_C_120: ' 120 millamp charge rate
    DO
    FOR laps = 0 TO 1000 ' The for and next is used to keep the from switching from high to Low on the LM317
    PWM 0, 250, 1 '(PWM Pin ,Duty, Duration) (Pin 0, Duty = 250, Duration = 1) = millamp_C_120

    NEXT
    LOOP
  • sam_sam_samsam_sam_sam Posts: 2,286
    edited 2010-12-29 12:42
    The code above is what I have so far in this project now I have to write the MAX186 code to control the charging voltage

    A few notes

    One there Full ON
    Second there is mill-amp_C_120 this range can be adj down but NO higher other than FULL ON
    Third there is mill-amp_C_10 this range can be adj up or down
    Fourth there is Full_OFF

    Back to the man cave again to work on a new board
Sign In or Register to comment.