[time-nuts] help

jimlux jimlux at earthlink.net
Mon May 2 16:56:16 UTC 2016


On 5/2/16 8:24 AM, Nick Sayer via time-nuts wrote:
> To flesh this out a bit more, on a Raspberry Pi, it would be easy to make a cron job that would pulse a GPIO pin high. They really *want* you to use Python (thus the name), but this is easy to do in just a shell script. First, do this to set things up:
>
> #! /bin/sh
>
> GPIO_PIN=9 # pick whatever one you like
>
> echo $GPIO_PIN > /sys/class/gpio/export
> echo out > /sys/class/gpio/gpio${GPIO_PIN}/direction
> echo 0 > /sys/class/gpio/gpio${GPIO_PIN}/value
>
> Next, run this script out of cron:
>
> #! /bin/sh
>
> GPIO_PIN=9
> echo 1 > /sys/class/gpio/gpio${GPIO_PIN}/value
> sleep 1
> echo 0 > /sys/class/gpio/gpio${GPIO_PIN}/value
>
> That will make a positive going pulse with the leading edge synchronized to cron (for sufficiently vague definitions of “synchronized”).
>
> As for the hardware side, take the GPIO pin and connect a 10k resistor between it and the base of a 2N4401 transistor. Connect the emitter to ground and the collector is a classic “open collector” switching output. Think of it like a switch connection to ground. When it’s on, there is a low impedance path to ground. When it’s off, it’s high impedance. You can use it to work a relay (be sure to add a flyback diode across the relay coil) or directly to switch any load that doesn’t exceed the abilities of the transistor.
>
> If you want to be a little safer, you can use an opto-isolator instead. Connect the GPIO pin to a 150 Ω resistor and then to the anode of the LED in an optoisolator. Connect the cathode to ground. The optoisolator itself can be either a phototransistor type or a driver triac type (the latter would be used to drive a power triac to switch AC loads on and off).
>
>


SSR data sheet at mouser (they are <$20)
http://www.mouser.com/ds/2/307/g3na_ds_e_11_1_csm165-892371.pdf

myriad varieties of inputs and outputs, whether it has an indicator 
(nice for testing), whether it's a zero voltage switch.

BUT.. it kind of looks like it wants to see 4V to turn on for sure. 
Maybe your 5V USB powered widget puts out that on a GPIO pin, maybe it 
doesn't. I've had very mixed luck with driving SSRs directly from logic 
(because the real threshold voltage and the real logic output voltage 
vary with temperature, for instance).

I'd use the extra transistor as an open collector and a 12V wall wart or 
similar to provide the current for the SSR input.






More information about the Time-nuts_lists.febo.com mailing list