Page 29 of 66

Posted: Thu Oct 09, 2008 5:50 pm
by Jeremy
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

Posted: Thu Oct 09, 2008 9:49 pm
by mattcarr
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

Posted: Thu Oct 09, 2008 11:25 pm
by retepsnikrep
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 :roll:

Re: Speed Sensor Calculations

Posted: Fri Oct 10, 2008 5:18 pm
by retepsnikrep
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:

Got a stinking cold so not doing a lot today :roll:

Re: Speed Sensor Calculations

Posted: Sat Oct 11, 2008 4:31 pm
by mikep_95133
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

Posted: Sat Oct 11, 2008 8:20 pm
by retepsnikrep
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. :wink:

Peter

Posted: Sun Oct 12, 2008 2:28 am
by centrex
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

Posted: Sun Oct 12, 2008 2:32 am
by retepsnikrep
Nice one centrex 8) only bad point is accuracy which is about 40mv but that's good enough for me :wink:

Edit Sadly I have Man Flu this weekend, which is very annoying as it has rendered me snotty, grumpy Image and unable to do much constructive project work :roll:

Edit OK I have re-written speed distance code using our new timed pulse in and the forumla provided by Jeremy & Matt. Thanks :wink:

Finished the new menu button code. But I'm not quite well enough to go into shed for a testing session :cry:

Posted: Mon Oct 13, 2008 1:31 am
by mikep_95133
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! :shock:

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.

Posted: Mon Oct 13, 2008 2:46 am
by retepsnikrep
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 :roll:

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 :? 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.