-
Last notes
02/13/2016 at 11:15 • 0 commentsBefore I forget, here are some more details.
The system worked great, almost out of the box.
For a better margin, I spied on the clock signal's waveform and the 'scope saw that the signal was too fast to go all the way to 0V so I slowed down the polling interval. The result was even better.
The system is fully synchronous because the Finite State Machine is driven by a high-speed, high-priority event loop for real-time display. This adds quite some jitter to the clock signal. This is not important as long as the clock is delayed and not triggered earlier (hello POSIX !). Special care was taken in the code to preven "early switching" which would disrupt the communication pretty often.
The rest of the code is a pretty standard Finite State Machine with 3 main states:
- init / desynchronised (waiting for the "1" marker)
- synchronising (waiting for a series of 9 "0"s)
- synchronised (running fine)
Hysteresis has been added in the code to absorb any spurious signals.
Oh, and there was even more fun tweaking the code to deal with multiple button presses!
-
Implementation
01/21/2016 at 13:02 • 2 commentsThe system is coming together nicely :-)
The two PCB have been soldered and tested, nothing special, except that I should have rotated the 4017 by 180°...
Some SMD parts are needed, for example the LVC1G14:
The cast aluminium box is solid and waterproof. A matching RJ45 plug completes the system:
Who wouldn't want to press these lovely buttons ?
Soon you'll enjoy them in Vallensbaek !
-
First signals
01/17/2016 at 16:06 • 0 commentsThe pair of remotes seems to work at first power-up :-)
I made a little script:
#!/bin/bash echo 4 > /sys/class/gpio/export echo in > /sys/class/gpio/gpio4/direction echo 11 > /sys/class/gpio/export echo in > /sys/class/gpio/gpio11/direction echo 7 > /sys/class/gpio/export echo out > /sys/class/gpio/gpio7/direction while true do # wrap around display so each round of 4017 is aligned for i in 1 2 3 4 5 6 7 8 9 10 do echo 1 > /sys/class/gpio/gpio7/value sleep 0.01 echo 0 > /sys/class/gpio/gpio7/value sleep 0.01 echo -n " "$(</sys/class/gpio/gpio4/value)","$(</sys/class/gpio/gpio11/value) done echo done
and the output is as expected !root@pi:/home/pi# ./test_pins.sh (nothing connected) 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 (connecting one remote) 0,0 0,0 0,0 0,0 1,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 1,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 1,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 1,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 1,0 0,0 0,0 0,0 0,0 0,0 (connecting another remote) 0,0 0,0 0,0 0,0 1,0 0,0 0,1 0,0 0,0 0,0 0,0 0,0 0,0 0,0 1,0 0,0 0,1 0,0 0,0 0,0 0,0 0,0 0,0 0,0 1,0 0,0 0,1 0,0 0,0 0,0 0,0 0,0 0,0 0,0 1,0 0,0 0,1 0,0 0,0 0,0 (pressing one button) 0,1 0,0 0,0 0,0 1,0 0,0 0,1 0,0 0,0 0,0 0,1 0,0 0,0 0,0 1,0 0,0 0,1 0,0 0,0 0,0 0,1 0,0 0,0 0,0 1,0 0,0 0,1 0,0 0,0 0,0 0,1 0,0 0,0 0,0 1,0 0,0 0,1 0,0 0,0 0,0 0,1 0,0 0,0 0,0 1,0 0,0 0,1 0,0 0,0 0,0 0,1 0,0 0,0 0,0 1,0 0,0 0,1 0,0 0,0 0,0 0,1 0,0 0,0 0,0 1,0 0,0 0,1 0,0 0,0 0,0 (release) 0,0 0,0 0,0 0,0 1,0 0,0 0,1 0,0 0,0 0,0 0,0 0,0 0,0 0,0 1,0 0,0 0,1 0,0 0,0 0,0 ....
Now I have to write the sync algorithms and create FSMs in C...
-
Isolation
12/01/2015 at 19:17 • 0 commentsFor extra safety, I'm wondering how to avoid damage to the host if "something" happened.
Tiny isolated DC/DC converters exist. It would be too much a hassle to make mine again (been there, yada yada).
Data isolation is another concern. It's a static design so no transformer is possible. An optoisolator is a good idea, or a more expensive isolator from ADi http://www.analog.com/en/products/interface-isolation/isolation/standard-digital-isolators.html
Safety first...
I found the CNY17-2 in my archives but I still have to locate the DC/DC.
The optoisolators change the signals that now work in current mode, so it's less sensitive to EMI. OTOH it increase the power consumption (but it's not critical).