Deconstructing the Sure Temperature Sensor

Technical questions and answers about the Mazda Bongo

Moderators: Doone, westonwarrior

jaylee
Supreme Being
Posts: 5500
Joined: Wed Mar 05, 2008 4:56 pm
Location: AQVAE SVLIS

Re: Deconstructing the Sure Temperature Sensor

Post by jaylee » Wed Sep 21, 2011 11:36 pm

Driver+Passengers wrote:
Driver+Passengers wrote:...I'm going to disconnect switches 1 and 2 to use the pin as an output to driver the buzzer, and hard code it in software to always display degC.
I've now permanently disabled SW1/2 on Bob's unit by removing resistors R23, R27 and R28, and fudged the ADC return value for AN11 (pin 12) to 0x3:0xFF (to simulate pull-up to 5V with both switches 1 and 2 open).

Fine so far. Next, I want to run the output from the PIC through a resistor to an NPN transistor, emitter to ground, collector via buzzer to 12V - for the volume. Though there is (just) enough space in the back of the unit to fit the mini-buzzer I've got, I may drill a hole in the back cover and have it poking out a mil' or two, just to get maximum sound pressure out of the unit.
Or run it on a lenth of wire to just behind (if space?) the little grill bit in the dash, to the left of the "glory hole", to the right of the top of the glove box..?
Cheaper by comparison to a race horse...
Image
User avatar
Driver+Passengers
Supreme Being
Posts: 2019
Joined: Mon Mar 14, 2011 1:56 pm
Location: Fife

Re: Deconstructing the Sure Temperature Sensor

Post by Driver+Passengers » Wed Sep 21, 2011 11:41 pm

jaylee wrote:
Driver+Passengers wrote:Instructions?!? #-o Would you be able to forward me a copy of that, for reference... not because I need it... ;)
Rhino-wayne found & posted it up on the "other thread"... http://www.sure-electronics.net/downloa ... 1.0_EN.pdf
:oops:
Ta, that helps.
Image Image
What she doesn't know won't hurt me.
jaylee
Supreme Being
Posts: 5500
Joined: Wed Mar 05, 2008 4:56 pm
Location: AQVAE SVLIS

Re: Deconstructing the Sure Temperature Sensor

Post by jaylee » Wed Sep 21, 2011 11:54 pm

Driver+Passengers wrote:
jaylee wrote:
Driver+Passengers wrote:Instructions?!? #-o Would you be able to forward me a copy of that, for reference... not because I need it... ;)
Rhino-wayne found & posted it up on the "other thread"... http://www.sure-electronics.net/downloa ... 1.0_EN.pdf
:oops:
Ta, that helps.
I am by no means an electronics expert... But just to point out a a possible potential prob with yer mod, regarding the dip switch...?? (I may be/hope i'm wrong would hate to see a possible oversight on a great project?) Have a look at section 4.2 & 4.2.2? :idea: :arrow:
Cheaper by comparison to a race horse...
Image
User avatar
Driver+Passengers
Supreme Being
Posts: 2019
Joined: Mon Mar 14, 2011 1:56 pm
Location: Fife

Re: Deconstructing the Sure Temperature Sensor

Post by Driver+Passengers » Thu Sep 22, 2011 12:05 am

jaylee wrote:I am by no means an electronics expert... But just to point out a potential prob with yer mod...?? (I may be/hope i'm wrong?) Have a look at section 4.2 & 4.2.2? :idea: :arrow:
I think I'm ok - I'm leaving K3 and K4 intact. Sacrificing the ability to display in degF, only K1 and K2 have been disconnected. Unless I've missed something subtle in those sections...
Image Image
What she doesn't know won't hurt me.
jaylee
Supreme Being
Posts: 5500
Joined: Wed Mar 05, 2008 4:56 pm
Location: AQVAE SVLIS

Re: Deconstructing the Sure Temperature Sensor

Post by jaylee » Thu Sep 22, 2011 12:25 am

Driver+Passengers wrote:
jaylee wrote:I am by no means an electronics expert... But just to point out a potential prob with yer mod...?? (I may be/hope i'm wrong?) Have a look at section 4.2 & 4.2.2? :idea: :arrow:
I think I'm ok - I'm leaving K3 and K4 intact. Sacrificing the ability to display in degF, only K1 and K2 have been disconnected. Unless I've missed something subtle in those sections...
Yep, i reckon its cool... Providing that K4 isn't set to change from C to F with the ambient brightness thing..? Sorry, i reckon i was fussin over nuffin! :roll: :oops:
Cheaper by comparison to a race horse...
Image
User avatar
Driver+Passengers
Supreme Being
Posts: 2019
Joined: Mon Mar 14, 2011 1:56 pm
Location: Fife

Re: Deconstructing the Sure Temperature Sensor

Post by Driver+Passengers » Thu Sep 22, 2011 7:41 am

Image

Image

I'm aware that my soldering leaves a lot to be desired. Gnd from gnd pad of the missing R20, nearly 12V from 'safe' side of F1, and signal from the appropriate pins on the PIC side of SW.

Code-wise, had to change the values written to TRISB and ANSELH.
Image Image
What she doesn't know won't hurt me.
tallbongo
Bongolier
Posts: 396
Joined: Sat Jul 31, 2010 5:40 pm
Location: Central Scotland

Re: Deconstructing the Sure Temperature Sensor

Post by tallbongo » Fri Sep 23, 2011 10:52 am

Some great work on this, and to avoid contaminating this thread in the way jaylee's was, I'll start a new one for my add on.

Regarding a calibration mod, have you decrypted the algorithm used to change voltage (I assume) into temp?
95 N Reg 4WD Manual AFT Bongo

Image Image
User avatar
Driver+Passengers
Supreme Being
Posts: 2019
Joined: Mon Mar 14, 2011 1:56 pm
Location: Fife

Re: Deconstructing the Sure Temperature Sensor

Post by Driver+Passengers » Fri Sep 23, 2011 1:17 pm

tallbongo wrote:Regarding a calibration mod, have you decrypted the algorithm used to change voltage (I assume) into temp?
Not yet. I'm working backwards from the digits on the display to see if I can find a register (or pair) containing the numeric temperature. There's a lookup table, and the first entry looks a bit like "-25", and presumably it interpolates as the lookup table only has so many values in it.

The PIC is configured to use the 8MHz internal oscillator and there is an OSCTUNE register. I don't know if this affects ADC.

Looking into it, though...
Image Image
What she doesn't know won't hurt me.
User avatar
g8dhe
Supreme Being
Posts: 10717
Joined: Sun Apr 13, 2008 10:06 pm
Location: Worthing, West Sussex.

Re: Deconstructing the Sure Temperature Sensor

Post by g8dhe » Fri Sep 23, 2011 1:44 pm

Driver+Passengers wrote:The PIC is configured to use the 8MHz internal oscillator and there is an OSCTUNE register. I don't know if this affects ADC.
Only if you reduce the Tad time to less than 1.5uS but you can always then divide the clock down by between 2 & 64 to increase it again, there is a longer "limit" 3uS in that they haven't characterised the chips longer than that.
One thing to watch out on the 16F6xx chips is that earlier versions had some bugs, that are documented in the errata sheets, not sure all have been squashed either!
Geoff
2001 Aero V6, AFT, full side conversion.
tallbongo
Bongolier
Posts: 396
Joined: Sat Jul 31, 2010 5:40 pm
Location: Central Scotland

Re: Deconstructing the Sure Temperature Sensor

Post by tallbongo » Fri Sep 23, 2011 9:16 pm

Driver+Passengers wrote:
tallbongo wrote:Regarding a calibration mod, have you decrypted the algorithm used to change voltage (I assume) into temp?
Not yet. I'm working backwards from the digits on the display to see if I can find a register (or pair) containing the numeric temperature. There's a lookup table, and the first entry looks a bit like "-25", and presumably it interpolates as the lookup table only has so many values in it.

That's a shame as it means the B value is unlikely to be buried in the code. However, if you ever decode the complete lookup table we should be able to calculate it (allowing the use of replacement thermistors without altering the code).
95 N Reg 4WD Manual AFT Bongo

Image Image
User avatar
Rhinoman
Bongolier
Posts: 330
Joined: Mon Jan 11, 2010 7:45 pm
Location: Brinkworth, Wilts
Contact:

Re: Deconstructing the Sure Temperature Sensor

Post by Rhinoman » Fri Sep 23, 2011 9:57 pm

The conversion will almost certainly be done using a look up table, the 16F only supports very basic maths. Unfortunately the look up tables are somewhat obfuscated by each entry being prefaced by the retlw instruction, otherwise they could be run through a simple 2D graphical analyser.
The 3uS on the ADC isn't significant because you're only charging a small cap on the input to the ADC itself, the minimum time is more important because you have to allow time for the cap to charge. The response time of the temperature sensors will be in the order of ms anyway.
1995 Ford Freda, 2.5TD, auto, AFT, side conversion.
User avatar
Driver+Passengers
Supreme Being
Posts: 2019
Joined: Mon Mar 14, 2011 1:56 pm
Location: Fife

Re: Deconstructing the Sure Temperature Sensor

Post by Driver+Passengers » Fri Sep 23, 2011 11:46 pm

Assuming they are all 16bit values, I get 149 values. Not convinced this is an ADC->deg lookup table?

Image
Image Image
What she doesn't know won't hurt me.
User avatar
Rhinoman
Bongolier
Posts: 330
Joined: Mon Jan 11, 2010 7:45 pm
Location: Brinkworth, Wilts
Contact:

Re: Deconstructing the Sure Temperature Sensor

Post by Rhinoman » Sat Sep 24, 2011 5:18 pm

Can you use a variable resistor to determine the input voltages across the specified temperature range? that will tell you the number of table entries that you're likely to be looking for.
Do you have a debugger? I'm pretty busy for the next few days but towards the end of the week I will try and get the ICD2 hooked up, then I can use breakpoints to see what addresses are being hit. Have you posted the latest disassembly anywhere?
1995 Ford Freda, 2.5TD, auto, AFT, side conversion.
tallbongo
Bongolier
Posts: 396
Joined: Sat Jul 31, 2010 5:40 pm
Location: Central Scotland

Re: Deconstructing the Sure Temperature Sensor

Post by tallbongo » Sat Sep 24, 2011 7:33 pm

Is this what you mean?

Image

Drover&Passengers - the data you posted could be the ADC lookup table, but not if the values 1 to 149 are linearly spaced.
95 N Reg 4WD Manual AFT Bongo

Image Image
User avatar
Driver+Passengers
Supreme Being
Posts: 2019
Joined: Mon Mar 14, 2011 1:56 pm
Location: Fife

Re: Deconstructing the Sure Temperature Sensor

Post by Driver+Passengers » Sat Sep 24, 2011 8:45 pm

I've been using PIC Simulator IDE. It's a little slow when running, but does the trick.

It reckons the voltage range on the ADC pins (beyond which I get "OL") is 0.27V-4.48V. The sensing circuit is a voltage divider consisting of thermistor to GND, 10K to 5V.

I'll have another poke at the code... (Rhinoman - email sent)
Image Image
What she doesn't know won't hurt me.
Post Reply

Return to “Techie Stuff”