In that case you could try this:
7908 / (pulsin / 10)
This will return the following:
1.2067 mph = 1.21
1.875mph = 1.88
3.75mph = 3.75
7.50 = 7.50
15.00 = 15.00
30.00 = 30.00
60.00 = 60.00
120.00= 120.00
You can recover the remainder using modulo division and then create an integer value from 12 (for 1.2mph) to 1200 (for 120.0mph) by appropriately scaling the two results.
You will still need to do the overflow check, which means that the speedo won't read below about 1.2mph. Your best bet might be to trap values that equate to less than 1.5mph, or perhaps 2 mph, and return zero.
Jeremy
Jeremy
Old BMS General Thread
Moderators: GregsGarage, retepsnikrep
I cant do any better than jeremy i'm afraid. The 16 bit is the limiting factor and the amount of resolution your going to get will be limited by this.
You could do a straight bit shift of my original calculations until you have the resolution you want which I think you said was down to 10th's of a mph.
Or use a different point to calculate from which uses integers.
mph = ( 5272 / pulsin reading ) * 15
You could do a straight bit shift of my original calculations until you have the resolution you want which I think you said was down to 10th's of a mph.
Or use a different point to calculate from which uses integers.
mph = ( 5272 / pulsin reading ) * 15
- retepsnikrep
- Posts: 1387
- Joined: Sat May 26, 2007 4:50 pm
- Location: North Yorkshire England
- Contact:
Gentlemen as always thanks for your help.
I'll have a look at both of your ideas and certainly use one of them in the new routine as it immediately saves the software 250ms at anything over about 5mph.
What happens if we only require our super 0.1mph resolution upto to say 65-70mph after this to nearest few mph would be good enough.
Now following on from that to work out feet per second travelled in last second is ? Now I could work this out (probably) but I'm working on the new code for the menu buttons![Rolling Eyes :roll:](./images/smilies/icon_rolleyes.gif)
I'll have a look at both of your ideas and certainly use one of them in the new routine as it immediately saves the software 250ms at anything over about 5mph.
What happens if we only require our super 0.1mph resolution upto to say 65-70mph after this to nearest few mph would be good enough.
Now following on from that to work out feet per second travelled in last second is ? Now I could work this out (probably) but I'm working on the new code for the menu buttons
![Rolling Eyes :roll:](./images/smilies/icon_rolleyes.gif)
Regards Peter
Two MK1 Honda Insight's. One running 20ah A123 Lithium pack. One 8ah BetterBattery Nimh pack.
One HCH1 Civic Hybrid running 60ah A123 Lithium pack.
Two MK1 Honda Insight's. One running 20ah A123 Lithium pack. One 8ah BetterBattery Nimh pack.
One HCH1 Civic Hybrid running 60ah A123 Lithium pack.
- retepsnikrep
- Posts: 1387
- Joined: Sat May 26, 2007 4:50 pm
- Location: North Yorkshire England
- Contact:
Re: Speed Sensor Calculations
retepsnikrep wrote:Wilfried wrote:retepsnikrep wrote:but anyone else any ideas?
Program your table in a SEEPROM (Serial Electrically Erasable Programmable ROM) and connect it to you PICAxe with only 2 lines.
16 adress -> 8 data AT24C512B from Atmel
Datasheet: http://www.atmel.com/dyn/resources/prod ... oc5297.pdf
Wilfried
That looks interesting I'll think about that for MK2 thanks.
OK I've ordered a couple just to play with for MK2!
Started on installing bms screen into car, found a neat discrete spot I think
![Wink :wink:](./images/smilies/icon_wink.gif)
Got a stinking cold so not doing a lot today
![Rolling Eyes :roll:](./images/smilies/icon_rolleyes.gif)
Regards Peter
Two MK1 Honda Insight's. One running 20ah A123 Lithium pack. One 8ah BetterBattery Nimh pack.
One HCH1 Civic Hybrid running 60ah A123 Lithium pack.
Two MK1 Honda Insight's. One running 20ah A123 Lithium pack. One 8ah BetterBattery Nimh pack.
One HCH1 Civic Hybrid running 60ah A123 Lithium pack.
-
- Posts: 28
- Joined: Thu Sep 25, 2008 6:38 pm
Re: Speed Sensor Calculations
Peter,
I built one of the slave boards this morning. The hole spacing does not fit the second generation 40ah yellow Thundersky cells that I have. I can machine the holes to make them fit.
This is just in case others order the same cells that I have.
Mike
I built one of the slave boards this morning. The hole spacing does not fit the second generation 40ah yellow Thundersky cells that I have. I can machine the holes to make them fit.
This is just in case others order the same cells that I have.
Mike
- retepsnikrep
- Posts: 1387
- Joined: Sat May 26, 2007 4:50 pm
- Location: North Yorkshire England
- Contact:
Mike
I made them to fit 40ah highpower cells and a number of others. Sadly you can't cover all eventualities. But as you say they are easy to machine/drill. Also people can download the schematics or pcb files from here and edit them/make there own pcb's to suit.
Peter
I made them to fit 40ah highpower cells and a number of others. Sadly you can't cover all eventualities. But as you say they are easy to machine/drill. Also people can download the schematics or pcb files from here and edit them/make there own pcb's to suit.
![Wink :wink:](./images/smilies/icon_wink.gif)
Peter
Last edited by retepsnikrep on Sun Oct 12, 2008 2:30 am, edited 1 time in total.
Regards Peter
Two MK1 Honda Insight's. One running 20ah A123 Lithium pack. One 8ah BetterBattery Nimh pack.
One HCH1 Civic Hybrid running 60ah A123 Lithium pack.
Two MK1 Honda Insight's. One running 20ah A123 Lithium pack. One 8ah BetterBattery Nimh pack.
One HCH1 Civic Hybrid running 60ah A123 Lithium pack.
Hi Peter
I have been following your posts, in particular measuring the supply voltage to the Picaxe.
I have a temperature logger with an lcd readout and I wanted to monitor the battery volts without having to drag out a multimeter to check.
I have implemented a version of your software useing a 2.5v reference (local electronic shop does not have the 1.25v).
I now can read the voltage at the last temperature reading, works very well.
Regards
Centrex
I have been following your posts, in particular measuring the supply voltage to the Picaxe.
I have a temperature logger with an lcd readout and I wanted to monitor the battery volts without having to drag out a multimeter to check.
I have implemented a version of your software useing a 2.5v reference (local electronic shop does not have the 1.25v).
I now can read the voltage at the last temperature reading, works very well.
Regards
Centrex
- retepsnikrep
- Posts: 1387
- Joined: Sat May 26, 2007 4:50 pm
- Location: North Yorkshire England
- Contact:
Nice one centrex
only bad point is accuracy which is about 40mv but that's good enough for me
Edit Sadly I have Man Flu this weekend, which is very annoying as it has rendered me snotty, grumpy
and unable to do much constructive project work
Edit OK I have re-written speed distance code using our new timed pulse in and the forumla provided by Jeremy & Matt. Thanks
Finished the new menu button code. But I'm not quite well enough to go into shed for a testing session![Crying or Very sad :cry:](./images/smilies/icon_cry.gif)
![Cool 8)](./images/smilies/icon_cool.gif)
![Wink :wink:](./images/smilies/icon_wink.gif)
Edit Sadly I have Man Flu this weekend, which is very annoying as it has rendered me snotty, grumpy
![Image](http://www.jonrb.com/emoticons/banghead.gif)
![Rolling Eyes :roll:](./images/smilies/icon_rolleyes.gif)
Edit OK I have re-written speed distance code using our new timed pulse in and the forumla provided by Jeremy & Matt. Thanks
![Wink :wink:](./images/smilies/icon_wink.gif)
Finished the new menu button code. But I'm not quite well enough to go into shed for a testing session
![Crying or Very sad :cry:](./images/smilies/icon_cry.gif)
Regards Peter
Two MK1 Honda Insight's. One running 20ah A123 Lithium pack. One 8ah BetterBattery Nimh pack.
One HCH1 Civic Hybrid running 60ah A123 Lithium pack.
Two MK1 Honda Insight's. One running 20ah A123 Lithium pack. One 8ah BetterBattery Nimh pack.
One HCH1 Civic Hybrid running 60ah A123 Lithium pack.
-
- Posts: 28
- Joined: Thu Sep 25, 2008 6:38 pm
GregsGarage wrote:Just got around to trying V1.08 and V1.07 but they don't work at all. I suspect a simple programming error as it reports 3 bytes downloaded to the pic!![]()
Anyway I don't see anything obvious, will have a look at this later.
Greg,
I just ran into the same issue using Picaxe Editor 5.2.0 After trying your removal of the commented text in the last few versions of Analog Slave software, I finally figured out the bug that causes these Analog Slave files to load with only 3 bits out of 256 being shown. Here is the problem area.
Use a generic adc input of 650 to simulate a cell voltage of 1.92V
Use a generic adc input of 400 to simulate a cell voltage of 3.16V
Use a generic adc input of 300 to simulate a cell voltage of 4.20V
#ENDREM
`Variables Constants and I/O definitions
1) I put my cursor to the left of the #ENDREM and hit backspace once, then return once. This makes is look like nothing changed.
2) I then put my cursor to the left of the apostrophe in `Variables Constants and I/O definitions and then hit backspace 2 times, then return 2 times.
These 2 steps make it look like the area around #ENDREM is not changed. But it does fix the issue with every revision of the Analog Slave software after 1.04.
To me, this is clearly a PicAxe Editor bug.
Home this helps others as well.
Mike
PS Greg was also right that the power has to be off to the Slave board when the Picaxe Editor is first told to run. Then in the first couple of seconds, the power is then turned on and then the downloading to the Picaxe chip works fine.
- retepsnikrep
- Posts: 1387
- Joined: Sat May 26, 2007 4:50 pm
- Location: North Yorkshire England
- Contact:
I agree it's an obscure Picaxe editor bug as the text always looks fine. No one reported this problem with the earlier version so it's a bit annoying.
Anyway you can just delete the REMED text or do some backspace hopscotch to get rid of what must be a hidden character causing the error
This is not consistently true though
for my 50 digital slaves it's not true at all as they see the download straight away and don't have to be powered off as described. Very odd but I suspect it's to do with the cheapo serial download system used which does not comply with the Serial PC standards but works on most machines (PC's) and is a bit of a fudge.
An enhanced serial download circuit is described in the Picaxe documentation, that may be more reliable, but I havent tried it.
Anyway you can just delete the REMED text or do some backspace hopscotch to get rid of what must be a hidden character causing the error
![Rolling Eyes :roll:](./images/smilies/icon_rolleyes.gif)
mikep_95133 wrote:Greg was also right that the power has to be off to the Slave board when the Picaxe Editor is first told to run. Then in the first couple of seconds, the power is then turned on and then the downloading to the Picaxe chip works fine.
This is not consistently true though
![Confused :?](./images/smilies/icon_confused.gif)
An enhanced serial download circuit is described in the Picaxe documentation, that may be more reliable, but I havent tried it.
Regards Peter
Two MK1 Honda Insight's. One running 20ah A123 Lithium pack. One 8ah BetterBattery Nimh pack.
One HCH1 Civic Hybrid running 60ah A123 Lithium pack.
Two MK1 Honda Insight's. One running 20ah A123 Lithium pack. One 8ah BetterBattery Nimh pack.
One HCH1 Civic Hybrid running 60ah A123 Lithium pack.
Who is online
Users browsing this forum: No registered users and 14 guests