First effort is a rotary encoder with two bits, connected to RPi GPIO with edge triggered interrupts (both rising and falling). Then I wrote an elaborate gray code decoder with effective debouncing. No library I found did it correctly, to include bouncing during the time the wiper contact is moving along the length of the conductive strip. (I’m not using optical encoders, but rather, cheapies).
Coded using Python’s GPIO library which is a wrapper on the C library. And the debounce and gray code decoder is all in Python 2.7. Again, to see if this can work. Lots of people say on the web that a fast processor is needed for rotary decoders. Of course, it depends on the shaft RPMs. A mechanical encoder (vice optical) would not be super fast. My use case is about 6RPM and 24 points per revolution. So that’s 24 * 2 edge changes per revolution, times about 2.5 for switch bounces.
What I found is that the overhead in Python and its GPIO event library (unaltered) is about 300 microseconds. The shortest valid encoder pulses I’ll encounter are a few 10’s of miliseconds. Divide that by two- because I’m analyzing both rising and falling edges of both bits in quadrature. The debounce code ignores pulses < 2mSec (and my scope shows some worse than that, an really low shaft speeds, like < 1RPM.
So I conclude that even with Python’s overhead (bytecode interpreter), and the RPi near-GHz CPU speed, and background networking CPU tasks, esp. on the 2 core RPIs, there is plenty of speed so as to not lose GPIO interrupt events. The Python code is event driven by GPIO bit changes; there are no polling loops.
What I’m doing is a home automation project, where I don’t use C (for a change), and don’t use multiple MCUs with all that such brings in complexity and too much code to sustain.
The Next Adventure: I put a pair of XBee Series one radios (IEEE 802.15.4) in the path from rotary encoder to RPi on which the Python code is running. To see if the shaft encoder gray code bit transitions can flow through the wireless link and still be decoded reliably by the RPi. Here, the goal is to use XBee’s with no alteration, no code. Just the XBee’s standard firmware that transmits GPIO edge transitions. And I’ll use the XBee’s ADCs for sensing via AC power line current transformers (washer/dryer is on/off). So far this works. Supporting the goal: No C, not MCU nodes to code, all in Python on the one RPi.
So far.
Shaft encoder used with garage doors to prevent SUV hatchback vs. door problem (cost me a $1K door for my lapse of attention on that). And washer/dryer alert relayed as they’re inaudible as located now.
I keep reverting to “gee, do this in C with an STM32” …. but the goal is to see what a $5 RPi can do in such a system, and in a rapid-development language like Python (once learned, it’s much, much faster to develop far fewer lines of code).
Just fiddling, really.
I believe that a non invasive approach wuold be a detection of the sound, or other signal, emitted by my washer when the door is unlocked (in my washer the door is unlocked only when it stops). But my washer is that one that has a door on one side, not the one with door on the top.
I believe that a non invasive approach wuold be a detection of the sound, or other signal, emitted by my washer when the door is unlocked (in my washer the door is unlocked only when it stops). But my washer is that one that has a door on one side, not the one with door on the top.
My first approach is to use a current sensor in the power cord. Using this
http://www.ebay.com/itm/5A-SCT-013-005- … SwI~VTx0Aq
And software to decide “done” is x minutes of no-current. Or some such.
However! I may drop this approach – because what the dryer operation expert tells me is needed, is an alert when the clothes are almost but not fully dry. So that shirts/pants can come out slightly damp and not wrinkled. So I want to try to use a humidity sensor in the dryer vent line. But the unsolved problem is how to keep the sensor from clogging with lint too quickly. Don’t want to have to clean it.
My first approach is to use a current sensor in the power cord. Using this
http://www.ebay.com/itm/5A-SCT-013-005- … SwI~VTx0Aq
And software to decide “done” is x minutes of no-current. Or some such.
That ebay PC board… I’d not want to use it because (a) it has no safe enclosure for mains voltages; (b) it requires cutting the power wire as I saw it; (c) I think it’s more intended for DC rather than AC. Versus the current sensing transformer which has neither of these drawbacks.
That ebay PC board… I’d not want to use it because (a) it has no safe enclosure for mains voltages; (b) it requires cutting the power wire as I saw it; (c) I think it’s more intended for DC rather than AC. Versus the current sensing transformer which has neither of these drawbacks.
I think I’ll stay with the split-core current transformer so that I don’t need to cut the AC wiring/extension cord. I certainly know how to do so safely, but I prefer to use passive means – for political reasons (fire insurance, mainly, as I had a neighbor whose home was lost and the insurance company found a non-UL approved thing and used that to deny most of his claim).
I did come across a youtube video, well done, where a fellow is showing a hall effect sensor patched in to AC mains. Generating .18V per Amp. I suspected that the specific PCB can handle AC, but it’s not so stated on the product sheet. Physics say it will work. But again, I’d prefer to stay passive, not alter wires.
Ordered a SHT11 sensor – will try that to estimate dryer is 90% done. Meet the operator spec!
It works well, but you need a small analog circuit to level shift the output waveform from the transformer.
Re:Insurance company denying a claim
I suspect that 99% of all homes have at least one device connected to mains that is technically not approved, so its a great get-out for all insurance companies.
I have found over the years that insurance companies usually find a way to not pay out, or if they do pay out. Next years premiums are sky high.
e.g. I had a ceiling fall in due to rain water leaking in.
The insurance company told me the house had not been built to code, so I was not insured, to have the problem fixed, but only to have the carpets cleaned.
The house is far from new ( probably 50 or more years old), which has been renovated several times, by various unknown builders employed by previous owners.
I also had a motoring insurance claim where I was hit buy a stolen car, who then drove away before the police arrived.
Again, this was a problem, as they insurance company could not cross claim from the other driver.
They car got repaired, but as the claim had been paid by my insurer, the premium next year went up 300% so It would have been cheaper to just pay for the repair to the car myself ( as it was only around $1000 of damage)
So, as you can see, I dont hold insurance companies in high regard
They car got repaired, but as the claim had been paid by my insurer, the premium next year went up 300% so It would have been cheaper to just pay for the repair to the car myself ( as it was only around $1000 of damage)
So, as you can see, I dont hold insurance companies in high regard
Probably loose loose.
Perhaps if I notified the insurance that I had been hit buy a stolen car and not claimed, then my policy would not go up, as the police would be able report that on an open road someone ran into the back of me (because I braked to avoid some idiot who decided to walk right across a 4 line highway)
After all, this accident was not my fault.

