Page 2 of 3

Re: Deconstructing the Sure Temperature Sensor

Posted: Wed Sep 21, 2011 11:36 pm
by jaylee
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..?

Re: Deconstructing the Sure Temperature Sensor

Posted: Wed Sep 21, 2011 11:41 pm
by Driver+Passengers
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.

Re: Deconstructing the Sure Temperature Sensor

Posted: Wed Sep 21, 2011 11:54 pm
by jaylee
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:

Re: Deconstructing the Sure Temperature Sensor

Posted: Thu Sep 22, 2011 12:05 am
by Driver+Passengers
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...

Re: Deconstructing the Sure Temperature Sensor

Posted: Thu Sep 22, 2011 12:25 am
by jaylee
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:

Re: Deconstructing the Sure Temperature Sensor

Posted: Thu Sep 22, 2011 7:41 am
by Driver+Passengers
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.

Re: Deconstructing the Sure Temperature Sensor

Posted: Fri Sep 23, 2011 10:52 am
by tallbongo
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?

Re: Deconstructing the Sure Temperature Sensor

Posted: Fri Sep 23, 2011 1:17 pm
by Driver+Passengers
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...

Re: Deconstructing the Sure Temperature Sensor

Posted: Fri Sep 23, 2011 1:44 pm
by g8dhe
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!

Re: Deconstructing the Sure Temperature Sensor

Posted: Fri Sep 23, 2011 9:16 pm
by tallbongo
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).

Re: Deconstructing the Sure Temperature Sensor

Posted: Fri Sep 23, 2011 9:57 pm
by Rhinoman
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.

Re: Deconstructing the Sure Temperature Sensor

Posted: Fri Sep 23, 2011 11:46 pm
by Driver+Passengers
Assuming they are all 16bit values, I get 149 values. Not convinced this is an ADC->deg lookup table?

Image

Re: Deconstructing the Sure Temperature Sensor

Posted: Sat Sep 24, 2011 5:18 pm
by Rhinoman
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?

Re: Deconstructing the Sure Temperature Sensor

Posted: Sat Sep 24, 2011 7:33 pm
by tallbongo
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.

Re: Deconstructing the Sure Temperature Sensor

Posted: Sat Sep 24, 2011 8:45 pm
by Driver+Passengers
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)