johncclayton / electric

Battery charger integration, information and provisioning
17 stars 11 forks source link

Fan control works! #112

Closed TheBum closed 6 years ago

TheBum commented 6 years ago

Fan control settings can be changed by PUTing a JSON blob to Pi3:5000/casefan. The blob can be partial or full and has the following fields defined:

"control": "on" (fan control enabled) or "off" (default: "off"). "threshold": fan start temperature in ºC (default: 37). "hysteresis": fan stop temperature delta from the threshold temp (default: 3). "gpio": the GPIO output number to use (NOT the header pin number) (default: 23 = header pin 16).

Fan control settings can be queried using GET Pi3:5000/casefan. All settings are returned in a JSON blob plus the current running state of the fan ("running": true or false).

I have added a PNG of the circuit schematic to docs/images.

TheBum commented 6 years ago

I have also worked up a wiring diagram using a prototyping circuit board that I could add to the docs images. In fact, I used it to wire up a second header socket with the circuit board extending toward the interior of the Pi 3 instead of hanging off the outside (the first attempt was done "on the fly" and I failed to account for flipping over the header socket). I will often get prototyping boards with pre-etched traces and cut them up as needed for small circuits because they mostly eliminate the need to run wires, thereby adding an element of neatness.

TheBum commented 6 years ago

There's a slight conflict between my prototype board wiring diagram and the potential iBump controller that I'll have to work out before I commit it.

scornflake commented 6 years ago

Hey Alan, I've committed a bunch of stuff to this branch. Added in a typed 'CaseFan' model object, which is then used in the REST interface. It provides some type and value safety. Small refactorings otherwise. I'll merge to master!

TheBum commented 6 years ago

I’m confused. I don’t see any new commits to my fork when I look at it on GitHub.

Alan

On Feb 26, 2018, at 01:54, Neil Clayton notifications@github.com wrote:

Hey Alan, I've committed a bunch of stuff to this branch. Added in a typed 'CaseFan' model object, which is then used in the REST interface. It provides some type and value safety. Small refactorings otherwise. I'll merge to master!

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

scornflake commented 6 years ago

Do they appear on your fork directly? Perhaps they are not included in this particular pull request. Perhaps we have to create another pull request to have them "seen" by github?

scornflake commented 6 years ago

btw: one breaking change will be "control" is now a boolean in the JSON. Don't use 'on' / 'off', use true and false instead.