Thanks for the kind words.magudaman wrote:Oh no not another project I must start!!! Very Very cool, I was looking to do something similar my self since I was finding nothing on the market that could pull this off inexpensively. Thank you very much Jeremy for putting this up and sharing with everyone PS where did you get that rocker switch that is in the photo near your throttle in the first post?
The only two serial displays I've driven from this chip are the AXE003 from the Picaxe people and the Cat's Whisker Textstar display that's in this thread: https://endless-sphere.com/forums/viewto ... =2&t=14498 Both work OK from any output pin on the 08M, in my experience.magudaman wrote:Alright I have been working on my own version of this little circuit for the last week but have changed the code quite a bit to allow for up to 30ah packs and would be independent of the controller. I am using a hall effect open loop current sensor to give the current readings. I would really like to add an LCD display to just interpret serial and give a percent and a fullness gauge. Since I have ditched the voltage sense part of the circuit I do have an extra output line. Is this within the capabilities of the 08, I do see that it can only do 4800 baud out the serial connections and all the cheap lcd units I see only have 9600 baud.
I think it should work, the reason I only write to eeprom every power shutdown was just to limit the number of write cycles to it, but the reality is that it should last a long time even if writing to it once a second. There should be time for this, you just need to adjust the pause values (coarse adjustment inside the repeated measurement routine, fine adjustment in the loop) to get back to 1 second (or whatever value you choose to use) for correctly calculating remaining capacity. In practice the shutdown routine very reliably detects power off and saves data in plenty of time before the power supply dies. If you wanted to make it independent of the controller, then adding a bit of capacitance to the supply will hold it up for the very short time that the Picaxe needs to save and shut down.magudaman wrote:I was thinking about dropping the average current sampling rate to 50 so I can save to eprom each round so users can shut down at any time. Is there enough time in a cycle for this in your experiences?
I hooked mine up to a USB 'scope, looked at the calibration output pulse edges and adjusted the two pauses to get as close as I could to 1 second between them. I managed to get mine to 999.8mS, which was plenty good enough. You could do the same with a counter/timer hooked up to this pulse, or even set it very roughly with a LED on the output and a stop watch.magudaman wrote:I see that you dump out a calibration pulse but how did you actually interpret that and calibrate your setup?
What's really needed to do this efficiently is a switch mode regulator, but they are hard to find at these high input levels. LFP pointed out in the simple controller thread that there are some cell phone chargers around that do the job, maybe gutting one of these might get you what you're after. If you can cope with a lower input voltage, then I think johnrobholmes has some for sale.magudaman wrote:I am also trying to get a consistent 5v and picked up some linear regulators that are good from 20-125v. So far in testing them they are consuming about 1.3 watts while my 5v output is only needing 0.075w. Is there any more efficient way to get 5v at such low power levels?
Good tips. It the obvious things like this that are so dead easy to miss. In my case it only writes to eeprom on a power loss event, where the value will almost certainly have changed since the last save, but it might still be worth doing the check I guess, as it doesn't take any headroom, that code is only run at power on.texaspyro wrote:One thing that you should do to extend EEPROM life in micros is first read the EEPROM value and compare to what you want to write. If they are the same, don't bother writing it. Very simple, very obvious, and for some strange reason it is seldom done. I know of one commercial product was killing its micro in under a month because of this very issue.
Another useful thing to do is after reading or writing an EEPROM location or page, read an EEPROM page that is not used by your code (for several reasons the page starting at address 0 is usually best... i.e. some micros are know to corrupt this page). This will leave the EEPROM address pointer pointing to unused data. This will minimize the chance of useful data being corrupted during power cycles/glitches.
Thanks for the kind words, Ben.BenMoore wrote:Regarding cheap and effective display options, could these units be employed?
Price is about $9 (inc post):
http://cgi.ebay.com.au/Digital-Thermome ... 2367wt_918
Just cut off the sensor and feed it a (biased and scaled) analogue voltage?
The numerical display and scale (-10 to 80C or the F equivalent mode) wouldn't be so helpful, but could simply be masked to leave the 19 segment LCD dot graph.
Weather proofing would also be required.
BTW, I'm a long time fan of your work here on ES Jeremy!
Have you used any pd or have setup the input to the lm chip at all ?. I just ran the filtered PWM signal straight into the chip ( I think from memory it was about 0-1.2v fsd ), I cant say as I notice this non-lin on my one. I have since changed it, and now only use one led to indicate low capacity ( off/on and flash ) and 2 other leds to indicate battery voltage ( blue(on/flash then off) red (on/flash), I personally find the voltage indicator more use than the other functions.magudaman wrote:Ok so I decided to go to the 10 segment led display for my unit after seeing how simple the LM3914 type unit is but have run into an issue. It seems that I ended up with a PWM output range of 155 to about 280. I have the equation setup so it sweeps that range based on percentage and is calibrated. But the new issue seems that my lm3914 is not very linear. It shows about 50 percent at about the 70% mark but then slows down end correctly when expected. I did have to use a capacitor to filter the PWM output so the display wouldn't go crazy.
What gives any ideas?
Yes I did set it up for a different range but took that out just for one less variable. I was trying to get 0 to 4v so I used a 1.2k resistor for the led current and 2.2k for the range. So with only the 1.2k resistor I end up as you said a 0 to 1.2v range (according to spec sheet) but it seems that to pulse that out of the chip I set it up to pmwout 2, 99, (100 to 240). What's odd is 100 calculates to 25% and 240 to 60%. ARG still isn't linear, maybe its an issue with the size of my capacitor?gwhy! wrote: Have you used any pd or have setup the input to the lm chip at all ?. I just ran the filtered PWM signal straight into the chip ( I think from memory it was about 0-1.2v fsd ), I cant say as I notice this non-lin on my one. I have since changed it, and now only use one led to indicate low capacity ( off/on and flash ) and 2 other leds to indicate battery voltage ( blue(on/flash then off) red (on/flash), I personally find the voltage indicator more use than the other functions.
I'm not sure that this will really be the case. I did something similar to lower the trigger voltage of the LEDs on my throttle (I just used a series resistor, as it turns out that the current variation as the LEDs turns on isn't that great) but found that the indication wasn't that reliable. I was running on a pack of Headway LiFePO4 cells at the time, that tended to sag a bit more then LiPo under load, but one thing I noticed was that the LEDs tended to drop as the power came on then recover back at lower power settings. Leaving the bike off for a few minutes would restore the "full power" indication as the cell terminal voltage recovered, even when I knew that the battery pack had to be close to being fully discharged. Trying to interpret the voltage drop under load with the battery charge state was difficult, which is why I opted to build this meter instead.otas wrote:Exactly, but I wanted to KISS - keep it simple s... LED's will start dropping off after approx 70% remaining power, which I think is acceptable. For me at least...