Shop OBEX P1 Docs P2 Docs Learn Events
Basic Stamp for Ammeter — Parallax Forums

Basic Stamp for Ammeter

jantmanjantman Posts: 4
edited 2005-04-26 06:52 in BASIC Stamp
I've never worked with BASIC Stamps (or any other such device) before, but have a foundation in electrical work, and quite a bit of programming.

The project I'm looking to make...

An ammeter for a vehicle. I'll have three shunts representing three different loads, all in excess of 100 Amps.

The final project will have a backlit LCD display, and will allow me to toggle through displaying the three different loads. Possibly I may integrate this into a larger system, in which case I will connect a few Stamp modules, and the Ammeter module will simply send data to the parent module.

Any ideas on how to do this, specifically the hardware to take the readings? I have no preference between using shunts versus an inductive setup, though I'slike to keep costs as LOW as possible. Accuracy is not too important.

Thanks,
Jason ANtman

Comments

  • KenMKenM Posts: 657
    edited 2005-04-22 20:15
    Which circuit of the car are you going to monitor?
  • JonathanJonathan Posts: 1,023
    edited 2005-04-22 20:27
    Jason,

    For that sort of thing I like Allegro's Hall effect current sensors.

    http://www.allegromicro.com/hall/currentsensor.asp


    Then feed the output into an ADC and thence to the Stamp. Simple and cheap. The Allegro sensor read both + and - current, perfect for your application.

    I did a similar project for a friends boat. I prefer the TLC2543 for the ADC, it can read directly in millivolts. Using a voltage divider you can read the battery voltage too. My friends boat has three seperate battery banks (one for the motor, two for house power) so the whole thing could be monitored for volts and current with one ADC.

    We were also able to display amp/hours remaining in the house banks and approximate time left under the current (no pun intended) load. We also integrated a low battery alarm for the motor battery, which would also sound if any current is draining after shut down. Simillarly the house banks have a low voltage alarm. All alarms can be canceled, of course.

    Jonathan



    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    www.madlabs.info - Home of the Hydrogen Fuel Cell Robot
  • HansHans Posts: 12
    edited 2005-04-25 14:01
    Wow. This is exactly what I'm working on right now. Thanks for the tip on those HAL sensors. I was
    planning on using shunts, but this is much easier. I've got my SX connected to a 4x20 LCD. My plan
    looks like this at the moment :

    Voltage and Current on both my battery banks.
    Charging current from the wind generator, if there's any coming in.
    Charging current from the shore power battery charger.
    (How can I tell with the ADC you mentioned which way the current is flowing ? Not sure on this one yet)
    Display of AH remaining in each bank. For this I've hooked up a simple 555 timer giving me
    a reasonably stable 1 PPS pulse. Each second I note the Amps drawn from each bank,
    and put that in some sort of formula to calculate how much Ah I've used.

    But I'm not stopping here. I'm gonna make it into a total ultimate on-board computer. I'm gonna
    monitor fuel left in each tank (I've got two) by measuring the resistance in the fuel sensors. I'm
    gonna do the same for the water tank and the waste tank. I'm gonna put a flow meter in the
    fuel line. For this I need an IC that can count pulses and store them, for me to read them out
    each second, preferably via the same serial readout that I use on the ADC. Any advice on whether
    such an IC exists is VERY welcome. This will tell me how much fuel per hour I'm using.
    I can also read the pulse length on the speed sensor. This way I can calculate boat speed, and thus
    calculate what distance I can still go with the remaining fuel.

    I might put one of those flow sensors in the potable water line as well, to see how much water
    is being used.

    Man. If you have a boat, you can have so much fun.
    You know, I've always had (among others) two hobbies. Electronics and programming. In that
    respect, this Basic Stamp constitutes a lethal combination. Lately, on very rare occasions,
    there's a very bright light shining on my head. Yesterday, my wife pointed out that it is called
    the 'sun'. You learn every day.

    Hans
    (The Netherlands)
  • JonathanJonathan Posts: 1,023
    edited 2005-04-25 15:01
    Hans,

    >>How can I tell with the ADC you mentioned which way the current is flowing ? Not sure on this one >>yet)

    The Allegro sensor are centered at 2.5V. Positive current flow raises the output, and negative current flow lowers it. Couldn't be easier.

    >Display of AH remaining in each bank. For this I've hooked up a simple 555 timer giving me
    >a reasonably stable 1 PPS pulse. Each second I note the Amps drawn from each bank,
    >and put that in some sort of formula to calculate how much Ah I've used.

    We found the whole amp/hour thing trickey. I'm not really sure just how accurate it is, but it will certainly help you keep an eye on it. We simply counted loops to keep time. Not super accurate but close enough. The timer starts when the motor is shut off.

    >I'm gonna
    >monitor fuel left in each tank (I've got two) by measuring the resistance in the fuel sensors.

    It's my experience that the float/pot type of fuel sensor is useless on a boat, especially in a lively seaway.

    >I'm gonna put a flow meter in the
    >fuel line.

    Expensive, but the way to go. I wouldn't bother with the other way at all. It does mean you will have to reset the system everytime you fuel up.

    >I can also read the pulse length on the speed sensor. This way I can calculate boat speed, and thus
    >calculate what distance I can still go with the remaining fuel.
    This will be wildly inaccurate. Boat speed and speed over the ground are two totally different things, unless you are on a pond. Much better would be·a GPS interface, and more than likely you have one on board or wouldn't mind getting one.

    >>Man. If you have a boat, you can have so much fun.

    To quote from The Wind in the Willows: "There is nothing so worth doing as just messing around with boats!"

    Badger couldn't have been more right on that one!

    Jonathan





    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    www.madlabs.info - Home of the Hydrogen Fuel Cell Robot
  • HansHans Posts: 12
    edited 2005-04-25 20:04
    Jonathan,

    >The Allegro sensor are centered at 2.5V. Positive current flow raises the output, and negative current flow lowers it. Couldn't be >easier.

    So clever [noparse]:)[/noparse]

    >We found the whole amp/hour thing trickey. I'm not really sure just how accurate it is, but it will certainly help you keep an eye >on it. We simply counted loops to keep time. Not super accurate but close enough. The timer starts when the motor is shut off.

    Yes, this was my guess also. Not too accurate, but a reasonable way to judge how much is being used. The lack of
    floating point calculations in the stamp is standing in the way of this. Because there's some good algorythms out there
    to calculate lead acid battery state. The more expensive battery monitors have this.

    >It's my experience that the float/pot type of fuel sensor is useless on a boat, especially in a lively seaway.

    Hmm. I guess I could write some dampening code for that. I'm gonna have a go at it anyway.

    >(Re: Fuel flow sensors) Expensive, but the way to go. I wouldn't bother with the other way at all. It does mean you will have to reset the system everytime you fuel up.

    Not too expensive. I've seen flow sensors, that can handle diesel fuel, for about $25. I need two, because of the engine's
    return line, but $50 is worth the joy of experimenting with it. It can do up to 1 liter / minute. 1800 pulses equals one
    liter with an accuracy of < 2%, and repeatability just a fraction of that. Good enough for me.

    >(re: speed sensor)This will be wildly inaccurate. Boat speed and speed over the ground are two totally different things, unless you are on a pond. Much better would be a GPS interface, and more than likely you have one on board or wouldn't mind getting one.

    Yes, in a way you are right. If you want to know how far you can travel with the fuel left. However if you look at it from the point of finding out the boat's most economical power setting, you wouldn't want your speed readings being diluted by things like current. You would want to measure against the speed through the water. On my old boat, a 30 ft sailboat, I could do 5 knots under
    engine, using roughly 2 liters/hour. At 5.5 knots, I would be closer to 3 ltr/hr. Ofcourse, I could easily hook up the GPS to the
    stamp without losing any pins. I could use the programming serial port I guess. Come to think of it, hooking up the GPS also
    gives me an *accurate* 1 pulse per second instead of the 555 timer........hmmmm.

    One other thing. If I have measured all the data that I did, I don't want to lose it all when I leave the boat and switch everything
    off. I want it to 'remember' things like Ah left in the batteries, fuel left, water left etc etc.
    Now first I thought I'd just write these values to non-volatile memory while the program is running. But then I read that you can only do this a limited number of times. So now I was thinking to put a big capacitor in the 5V supply, and input the divided unregulated voltage of the battery to one of the stamps pins. This way, when I switch off the batteries, the stamp reads this by that pin going low, and still has time to write some data into non-volatile memory. Would this work ? Has it been done ? Or are there
    better ways ?

    Hans
    a fraction of a second left to write
  • JonathanJonathan Posts: 1,023
    edited 2005-04-25 23:50
    Hans,

    >It's my experience that the float/pot type of fuel sensor is useless on a boat, especially in a lively seaway.

    >Hmm. I guess I could write some dampening code for that. I'm gonna have a go at it anyway.

    Let me know how it works out. I never tried one with a Stamp.

    >(Re: Fuel flow sensors) Expensive, but the way to go. I wouldn't bother with the other way at all. It does mean you will have to reset the system everytime you fuel up.

    >Not too expensive. I've seen flow sensors, that can handle diesel fuel, for about $25. I need two, >because of the engine's
    >return line, but $50 is worth the joy of experimenting with it. It can do up to 1 liter / minute. 1800 >pulses equals one
    >liter with an accuracy of < 2%, and repeatability just a fraction of that. Good enough for me.

    Wow! Do you have a link? That is *way* cheaper than I found. US$25 is very reasonable. Good thing we have some I/O left on my friends unit, I know he'll want to add that!

    >However if you look at it from the point of finding out the boat's most economical power setting, you >wouldn't want your speed readings being diluted by things like current. You would want to measure >against the speed through the water. On my old boat, a 30 ft sailboat, I could do 5 knots under
    >engine, using roughly 2 liters/hour. At 5.5 knots, I would be closer to 3 ltr/hr.

    Assuming the knotmeter you have is the standard paddlewheel type, your boatspeed will read high if ploughing into a current and low if you have a following current. Speed over the bottom is much better.

    >Come to think of it, hooking up the GPS also
    >gives me an *accurate* 1 pulse per second instead of the 555 timer........hmmmm.

    Time and date too.
    >So now I was thinking to put a big capacitor in the 5V supply, and input the divided unregulated >voltage of the battery to one of the stamps pins. This way, when I switch off the batteries, the >stamp reads this by that pin going low, and still has time to write some data into non-volatile >memory. Would this work ?

    You bet. Get some super caps and the whole thing could run for hours after shutdown. You could also hardwire the unit and leave it on all the time. Very low battery drain.

    Jonathan



    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    www.madlabs.info - Home of the Hydrogen Fuel Cell Robot
  • HansHans Posts: 12
    edited 2005-04-26 06:52
    www.environmental-expert.com/technology/digmesa/digmesa.htm

    Somewhere on that page is the 'FHKSC' flow meter. On a dutch components site that one
    is on offer for about 20 euro. According to the spec sheet you can use it for fuel. It accepts
    5 - 24 volts supply. Not sure where you could order this one in the states.

    Hans
    (sorry for hijacking this thread....)
Sign In or Register to comment.