Battery third (temp) terminal as multipurpose analogue input - page 2 - Hotwire! Hardware Mods, Accessories and Insights - CHDK Forum

Battery third (temp) terminal as multipurpose analogue input

  • 199 Replies
  • 31493 Views
Re: Battery third (temp) terminal as multipurpose analogue input
« Reply #10 on: 18 / July / 2013, 08:41:42 »
Advertisements
Quote
I know its not where you are trying to go,  but with a simple & cheap Arduino clone, you could read the ultrasonic sensor, convert distance to a pulse width modulated 5V signal and feed that via the USB port on the camera to be read by a CHDK script.
USB would probably be better suited than the battery terminal to something like the ultrasonic sensor, but the problem I had with it was that on most cameras the USB port was located right on the side of the hand-grip, making it difficult to hold the camera while something is connected, as well as the likelihood of the plug/socket snapping if the camera is, uh, dropped...

I have conducted further testing on my SX40 and it behaves a little differently than the IXUS65 with regards to how it reads the temperature. The IXUS65 (as mentioned earlier) gives almost instantaneous functions with the get_temperature(2), but on the SX40 it only changes every second (and even then changes are sluggish as if they are being averaged over longer periods of time).

Surprisingly, that address actually worked, the output of peek(0xc090004a,2) returned a value between 0 and 1023 depending on the resistance. I guess that means they are likely to be the same between other models as well? The values were also reasonably consistent between both cameras. 10 bits of resolution should be sufficient for most purposes I had in mind.

Edit:
I have compiled another table of values. They are attached this time. As expected, the voltage vs value is linear.
All that remains for me to do is to find out how fast I can read the values (maybe fast enough to capture lightning with an LDR?) then I guess I need to write some scripts and make some stuff to make use of it.

Edit: I am considering opening up the SX40 to take out that 18k ohm pull-up resistor that's been bugging me. Then I will be able to measure any high-impedance output I want and get a linear result. I think I'll also add a connection beneath the hot-shoe cover as well, or maybe I should save that for another thread.
« Last Edit: 18 / July / 2013, 09:29:09 by Recyclojunk64 »

*

Offline ahull

  • *****
  • 634
Re: Battery third (temp) terminal as multipurpose analogue input
« Reply #11 on: 18 / July / 2013, 09:41:51 »
EDIT: This information actually relate to the S3IS, not as I first stated, the Ixus 60/65 manual.

Not sure if this adds much, but a quick trawl through the Ixus 60/65 S3IS diagram reveals the following signal names and some sense of their meanings.

Signal         Meaning
AD_AIN0 - CP1010  - Also called Y12  - Calibration test point?
AD_AIN1 - CP1011  - Also called AD12 - Calibration test point?
AD_AIN2 - BAT_SENSE from battery via mosfet
AD_AIN3 - CCD_TEMP
AD_AIN4 - OPT_TEMP - Also called AB12
AD_AIN5 - BAT_TEMP - Also called AA14
AD_AIN6 - POWER_DET_E2
AD_AIN7 - POWER_DET_LCD
AD_AIN8 - POWER_DET_E20
AD_AIN9 - DC_JACK_DET

« Last Edit: 18 / July / 2013, 13:03:33 by ahull »

Re: Battery third (temp) terminal as multipurpose analogue input
« Reply #12 on: 18 / July / 2013, 10:28:21 »
I have compiled another table of values. They are attached this time. As expected, the voltage vs value is linear.
All that remains for me to do is to find out how fast I can read the values (maybe fast enough to capture lightning with an LDR?) then I guess I need to write some scripts and make some stuff to make use of it.
This raises an interesting possibility for the existing USB remote code.  Right now, when the remote is enabled,  USB communication (ptp) is disabled.   This can be annoying at times so using the battery temperature sensor terminal as an alternative remote trigger input might be a clever option.
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline nafraf

  • *****
  • 1305
Re: Battery third (temp) terminal as multipurpose analogue input
« Reply #13 on: 18 / July / 2013, 11:02:29 »
Not sure if this adds much, but a quick trawl through the Ixus 60/65 diagram reveals the following signal names and some sense of their meanings.
Have you tried to read those values using _GetAdChValue function?


*

Offline ahull

  • *****
  • 634
Re: Battery third (temp) terminal as multipurpose analogue input
« Reply #14 on: 18 / July / 2013, 11:06:31 »
Not sure if this adds much, but a quick trawl through the Ixus 60/65 diagram reveals the following signal names and some sense of their meanings.
Have you tried to read those values using _GetAdChValue function?

Not yet, I do have an Ixus 60 somewhere so if I get the time I'll give it a shot, I suspect it will confirm this..

Quote from: reyalp
0xc0900046:0x00e0 < ccd temp
0xc0900048:0x010a < optical temp
0xc090004a:0x00d7 < battery temp

...
...

edit:
I think 0xc0900044 is related to battery voltage. ~0x351 at 4.2 volts (external power), ~0x2d9 at 3.66 volts (battery, rec mode)

This looks to tie in nicely with the signal names, and suggests that for the Ixus 60 and 65 S3IS at least, we have a block of A/D converters starting at 0xc0900040

Looking in all probability like this...

0xc0900040: AD_AIN0 - CP1010  - Also called Y12  - Calibration test point?
                                                              - available as a small solder pad on the main PCB
0xc0900042: AD_AIN1 - CP1011  - Also called AD12 - Calibration test point?
                                                               - also available as a small solder pad on the main PCB
0xc0900044: AD_AIN2 - BAT_SENSE from +ve terminal of Main Battery via mosfet
0xc0900046: AD_AIN3 - CCD_TEMP
0xc0900048: AD_AIN4 - OPT_TEMP - Also called AB12
0xc090004a: AD_AIN5 - BAT_TEMP - Also called AA14
0xc090004c: AD_AIN6 - POWER_DET_E2
0xc090004e: AD_AIN7 - POWER_DET_LCD
0xc0900050: AD_AIN8 - POWER_DET_E20
0xc0900052: AD_AIN9 - DC_JACK_DET


EDIT: I just looked at a Main board from an Ixus 60, looks like CP1010 and CP1011 would require "Extreme Ninja level 10" soldering skills to connect. The test jig for this board must have some mighty small pogo pins on it.
« Last Edit: 18 / July / 2013, 13:04:17 by ahull »

Re: Battery third (temp) terminal as multipurpose analogue input
« Reply #15 on: 18 / July / 2013, 12:12:30 »
How is the  _GetAdChValue function used? (google search turned up nothing) And does it have any advantage over the peek function?

0xc0900040 returned a decimal value of 20 and
0xc0900042 jumped between 511 and 512 (so I guess it just happened to be centred for some reason)

I think I will open up the IXUS65 again tomorrow and find those test points. Three A/D inputs would allow all sorts of crazy ideas to happen. Now if only there was a spare DAC in there as well...

Until then I will leave you with a photo of it's main-board that I took a while ago. Note the separate packages that make up the DIGIC II processor. Any idea of where to start looking for those test points? Would the Analogue Devices chip handle these points as well as the CCD?
http://recyclojunk64.comxa.com/Images/JMN18666.JPG


EDIT: just read your edit, are the points on the back of the board and is there silkscreen labelling there for the points? I think I might have a look now actually. Probably more chance of me soldering them when I'm half asleep if they really are that small.
« Last Edit: 18 / July / 2013, 12:21:29 by Recyclojunk64 »

*

Offline ahull

  • *****
  • 634
Re: Battery third (temp) terminal as multipurpose analogue input
« Reply #16 on: 18 / July / 2013, 12:31:38 »
Quote
Any idea of where to start looking for those test points? Would the Analogue Devices chip handle these points as well as the CCD?
Well a word of caution, I was reading the wrong diagram ! The info I gave was from the S3IS manual..  :-[

A revised set of inputs from the Ixus 60 and 65 is below...

DigicII
Signal  - Ixus60/65

AD_AIN0 - REC_OUT IC4501 - AUDIO/VIDEO DRIVER AN12915A
AD_AIN1 - VCHGLVL -
AD_AIN2 - Via Q1010 - BATTERY CHECK
AD_AIN3 - VCCDTEMP
AD_AIN4 - [NC]
AD_AIN5 - VBATTEMP
AD_AIN6 - VCC2_DET2
AD_AIN7 - VDD3-DET
AD_AIN8 - F_RST_AD - AF RESET PI    << Interesting..
AD_AIN9 - Z_RST_AD - ZOOM RESET PI  << Likewise...
AD_AIN10 - VDD1-3.3_SC
AD_AIN11 - VCHGLVL

So we might not have the additional 2 AD channels (but AD_AIN4 seems to be unused, I will see if it appears anywhere).
EDIT: No sign of AD_AIN4 anywhere in the diagram.

For reference (and because I am clearly too daft to read them myself) here is a link to the forum post about these manuals.

EDIT: Can't find any free A/D, but I did find some GPIO and a serial port...

Unused GPIO broken out to test points..

GPIO_P13 - CP1019
GPIO_W22 - CP1016

Serial port (3v3)

CP1012,1015 RXD0
CP1011,1014 TXD0

EDIT: Page 16 or thereabouts of the manual would tell you where those test pins are if you feel the urge to do a bit of soldering.
« Last Edit: 18 / July / 2013, 13:26:50 by ahull »

*

Offline reyalp

  • ******
  • 11747
Re: Battery third (temp) terminal as multipurpose analogue input
« Reply #17 on: 18 / July / 2013, 17:17:16 »
How is the  _GetAdChValue function used? (google search turned up nothing) And does it have any advantage over the peek function?
On my A540
Code: [Select]
con> =return call_event_proc('Driver_EnableEventProc')
1:return:0
...
con 2> =return call_event_proc('GetAdChValue',1)
3:return:0
con 4> =return call_event_proc('GetAdChValue',2)
5:return:701
con 5> =return call_event_proc('GetAdChValue',3)
6:return:10
con 6> =return call_event_proc('GetAdChValue',4)
7:return:333
con 7> =return call_event_proc('GetAdChValue',5)
8:return:340
con 8> =return call_event_proc('GetAdChValue',6)
9:return:10
con 9> =return call_event_proc('GetAdChValue',7)
10:return:739
con 10> =return call_event_proc('GetAdChValue',8)
11:return:2
con 11> =return call_event_proc('GetAdChValue',9)
12:return:1
con 12> =return call_event_proc('GetAdChValue',10)
13:return:1015
con 13> =return call_event_proc('GetAdChValue',11)
14:return:4
con 14> =return call_event_proc('GetAdChValue',12)
15:return:65535
con 15> =return call_event_proc('GetAdChValue',13)
16:return:65535
con 16> =return call_event_proc('GetAdChValue',14)
17:return:65535
con 17> =return call_event_proc('GetAdChValue',0)
18:return:513
I think there's only 12 channels, GetAdChValue returns -1 on invalid. It looks like the same eventprocs should work on ixus65. These do not appear to be queried directly from MMIO, it looks like there's an interrupt handler involved on these cams. The values returned may also be massaged in some way.

Native calls will need to be enabled to do this, in CHDK 1.2, you can turn this on in the chdk menu.

edit:
I moved this thread to a more appropriate sub forum.

edit:
Equivalent eventprocs exist on D10:
call_event_proc('Driver.Create')
registers GetAdChValue, which calls the function I mentioned earlier at FF843FC0 to read the MMIOs. So on D10 at least, it reports the MMIO values directly.
« Last Edit: 19 / July / 2013, 02:13:31 by reyalp »
Don't forget what the H stands for.


Re: Battery third (temp) terminal as multipurpose analogue input
« Reply #18 on: 04 / January / 2014, 05:39:47 »
Hello, has there been any progress in this project?  :)

*

Offline ahull

  • *****
  • 634
Re: Battery third (temp) terminal as multipurpose analogue input
« Reply #19 on: 04 / January / 2014, 08:02:24 »
Nope, simply because I got involved in other things.

Theoretically its quite simple, but needs a little bit of hardware hacking. You would need to construct a dummy battery with three terminals, and connect this up to power the camera with some sort of small three pin connector. The middle pin (assuming an NB4L battery) would be your analog input, which can be read via a script.
 

 

Related Topics