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

Battery third (temp) terminal as multipurpose analogue input

  • 199 Replies
  • 80070 Views
Re: Battery third (temp) terminal as multipurpose analogue input
« Reply #60 on: 18 / January / 2014, 21:26:21 »
Advertisements
Note that cameras that use AA cells ( principally the A series ) will not have a battery temperature sensor input.

Pity that - my SX150IS use AA.


Re: Battery third (temp) terminal as multipurpose analogue input
« Reply #61 on: 20 / January / 2014, 10:04:58 »
Hello again. Success over here: I got the connection into the camera working. Using your script, - waterwingz (thank you!), it seems that GetAdChValue(5) is the one I am looking for. This is very exciting!  8)

closed switch:

0: 1023   1: 1023   2:  835   3:  215
4:  346   5:  340   6:  805   7: 1023
8:    0   9:    0  10:  562  11:  497

open switch:

0: 1023   1: 1023   2:  831   3:  246
4:  374   5: 1023   6:  806   7: 1023
8:    0   9:    0  10:  562  11:  495

Okay, now I will try to to find the resources to make CHDK listen to the battery temperature sensor to start a shot? I suppose I will need some help with it, but I will try to find out what to do by having a look what ahull already posted.

Thanks a lot so far! Martin...

btw.: if you wonder why the battery door is open and the camera is nevertheless on: It is piece of a match squeezed into the sensor switch of the door.  You can even see it next to the SD card :)
« Last Edit: 20 / January / 2014, 10:08:30 by Karmaschinken »

Re: Battery third (temp) terminal as multipurpose analogue input
« Reply #62 on: 20 / January / 2014, 11:44:53 »
Okay, now I will try to to find the resources to make CHDK listen to the battery temperature sensor to start a shot? I suppose I will need some help with it, but I will try to find out what to do by having a look what ahull already posted.
Give me a day or two and I'll send you a patch file of what I've been working on.  It should give you what you need and having someone else to test will help prior to adding to the autobuild.
Ported :   A1200    SD940   G10    Powershot N    G16

Re: Battery third (temp) terminal as multipurpose analogue input
« Reply #63 on: 20 / January / 2014, 13:14:03 »
Thanks a lot.  I try to wait although I can't. I'd be very happy to make this run on 10 cams to see how they sync then.

Will this be part of the official release?

Thanks!


Re: Battery third (temp) terminal as multipurpose analogue input
« Reply #64 on: 20 / January / 2014, 15:04:42 »
Thanks a lot.  I try to wait although I can't. I'd be very happy to make this run on 10 cams to see how they sync then.
I'll do it tonight then.

Quote
Will this be part of the official release?
Some day, probably.
Ported :   A1200    SD940   G10    Powershot N    G16

Re: Battery third (temp) terminal as multipurpose analogue input
« Reply #65 on: 20 / January / 2014, 16:37:48 »
I didn't want to urge you of course!

Re: Battery third (temp) terminal as multipurpose analogue input
« Reply #66 on: 20 / January / 2014, 23:06:05 »
I didn't want to urge you of course!
Cheap & dirty patch file attached - sx200 only.   Obviously not tested on that camera - it runs on my G10 with the right additions but I have not wired the fake battery up.  I will do so if the patch fails to work for you.

It scans A/D channel 5 when the USB remote is enable via the CHDK menus - leaving the USB port free for ptp communications.    The reading from the A/D is displayed in the upper left hand corner of the LCD for reference.

Note that you will likely need a lower resistance value than what you used in the tests you have posted.  Normal room temperature values read around 340 on my G10 - so inserting a normal battery will cause this code to think the USB remote has been pressed if we use the values from your test.   This code wants the input reading to be less than 200 - adjust your series resistor value  until you get a value below that on the LCD display hack I added.

Prior to adding this to the svn, it will need CHDK menu configuration choices for adjustable thresholds, battery channel used (?),   USB vs A/D triggering, lots of testing,  arguement in the forum about text strings, coding conventions, C style and variable naming,  and other normal spit polish,  etc -  but for now it should suffice for your tests (including initial sync quality testing).

Edit : added complete build for sx200is-100c-1.3.0-3322-full.zip
« Last Edit: 21 / January / 2014, 00:15:27 by waterwingz »
Ported :   A1200    SD940   G10    Powershot N    G16

Re: Battery third (temp) terminal as multipurpose analogue input
« Reply #67 on: 21 / January / 2014, 08:05:08 »
A couple of notes on the patch attached above.

It may not work with sync enabled ( testing needed ).  If _GetAdChValue()  does not actually read from the A/D chip directly then the sync code will loop forever and time out. I have not actually looked at what GetAdChValue does.

Also,  as reyalp point out on IRC last night,   some cameras may pass values to _GetAdChValue() differently (by value or by reference). This patch assume "by value".

Finally,  shooting_set_playrec_mode() in core/shooting.c may not be right as the patch messes with get_usb_bit_physw().
« Last Edit: 21 / January / 2014, 08:57:38 by waterwingz »
Ported :   A1200    SD940   G10    Powershot N    G16


Re: Battery third (temp) terminal as multipurpose analogue input
« Reply #68 on: 21 / January / 2014, 09:32:52 »
Thanks a lot. I had an accident so wasn't able to test the patch now.  But at least I could compile it with the patch put onto the newest build. When having a battery in the cam a value of +-430 shows up in the left corner.  So the reading works fine.

Hope I can test the shooting that evening.  Thank you so much.

Re: Battery third (temp) terminal as multipurpose analogue input
« Reply #69 on: 21 / January / 2014, 15:39:05 »
Wooooohooo! Million thanks to you, guys, especially ahull and waterwingz! Got it working here for the first time. I have "remote" enabled and also the sync option. I changed the 10k resistor to 2.2k, now the GetAdChValue(5) shows a value ~100. Tomorrow I'll start building ten dummies and then will do some sync testing.

But there is one thing. Until now when having the camera  to USB I switched it on and some autostart.lua ran. Know the camera stucks in the ALT-Mode, the autostart script does not run anymore. I suppose the camera is in the play mode?

I suppose it has to do with these lines:

Code: [Select]
- if (conf.remote_enable) {
- physw_status[USB_IDX] = physw_status[USB_IDX] & ~(SD_READONLY_FLAG | USB_MASK);
- } else {
+// if (conf.remote_enable) {
+// physw_status[USB_IDX] = physw_status[USB_IDX] & ~(SD_READONLY_FLAG | USB_MASK);
+// } else {
  physw_status[USB_IDX] = physw_status[USB_IDX] & ~SD_READONLY_FLAG;
- }
+// }


Changing this back to the original mode - before dealing with both PTP and Remote at the same time - makes it work as expected.

All right, now tomorrow there is a lot of work waiting!  :)
« Last Edit: 21 / January / 2014, 15:40:37 by Karmaschinken »

 

Related Topics


SimplePortal 2.3.6 © 2008-2014, SimplePortal