BB
Bill Baker
Sun, May 1, 2016 7:26 PM
My problem: I'd like some kind of off-the-shelf device that can take the time code and switch on or impulse another circuit-- specifically I'd like to trigger a 180 year-old fog bell (I'm a lighthouse nut as well, www.henryisland.com) on the hour and maybe be able to impulse my minute school clocks. I'm not at this group's technical level, so it's got to be pretty easy to program. So I need a box that I can program with SMPTE time in and a timed switch impulse out. Any ideas?
Many thanks,
W1BKR
My problem: I'd like some kind of off-the-shelf device that can take the time code and switch on or impulse another circuit-- specifically I'd like to trigger a 180 year-old fog bell (I'm a lighthouse nut as well, www.henryisland.com) on the hour and maybe be able to impulse my minute school clocks. I'm not at this group's technical level, so it's got to be pretty easy to program. So I need a box that I can program with SMPTE time in and a timed switch impulse out. Any ideas?
Many thanks,
W1BKR
J
jimlux
Sun, May 1, 2016 8:26 PM
On 5/1/16 12:26 PM, Bill Baker via time-nuts wrote:
My problem: I'd like some kind of off-the-shelf device that can take the time code and switch on or impulse another circuit-- specifically I'd like to trigger a 180 year-old fog bell (I'm a lighthouse nut as well, www.henryisland.com) on the hour and maybe be able to impulse my minute school clocks. I'm not at this group's technical level, so it's got to be pretty easy to program. So I need a box that I can program with SMPTE time in and a timed switch impulse out. Any ideas?
Many thanks,
W1BKR
An Arduino or Teensy (http://www.pjrc.com) are both trivially easy to
program and have easy interfaces (With a large number of off the shelf
interface widgets like relays, optoisolators, etc.). There's probably
off the shelf code and hardware interfaces for decoding your SMPTE or
other time codes.
The coding would be simple - the widget's not doing anything else, so
there's nothing wrong with a structure like
void loop(){
if (msgavailable) {
get message
decode message
if right message{
digitalWrite(relaypin,HIGH)
sleep (10)
digitalWrite(relaypin,LOW)
}
}
}
On 5/1/16 12:26 PM, Bill Baker via time-nuts wrote:
> My problem: I'd like some kind of off-the-shelf device that can take the time code and switch on or impulse another circuit-- specifically I'd like to trigger a 180 year-old fog bell (I'm a lighthouse nut as well, www.henryisland.com) on the hour and maybe be able to impulse my minute school clocks. I'm not at this group's technical level, so it's got to be pretty easy to program. So I need a box that I can program with SMPTE time in and a timed switch impulse out. Any ideas?
> Many thanks,
> W1BKR
An Arduino or Teensy (http://www.pjrc.com) are both trivially easy to
program and have easy interfaces (With a large number of off the shelf
interface widgets like relays, optoisolators, etc.). There's probably
off the shelf code and hardware interfaces for decoding your SMPTE or
other time codes.
The coding would be simple - the widget's not doing anything else, so
there's nothing wrong with a structure like
void loop(){
if (msgavailable) {
get message
decode message
if right message{
digitalWrite(relaypin,HIGH)
sleep (10)
digitalWrite(relaypin,LOW)
}
}
}
J
jimlux
Sun, May 1, 2016 9:24 PM
On 5/1/16 1:26 PM, jimlux wrote:
On 5/1/16 12:26 PM, Bill Baker via time-nuts wrote:
My problem: I'd like some kind of off-the-shelf device that can take
the time code and switch on or impulse another circuit-- specifically
I'd like to trigger a 180 year-old fog bell (I'm a lighthouse nut as
well, www.henryisland.com) on the hour and maybe be able to impulse my
minute school clocks. I'm not at this group's technical level, so
it's got to be pretty easy to program. So I need a box that I can
program with SMPTE time in and a timed switch impulse out. Any ideas?
Many thanks,
W1BKR
An Arduino or Teensy (http://www.pjrc.com) are both trivially easy to
program and have easy interfaces (With a large number of off the shelf
interface widgets like relays, optoisolators, etc.). There's probably
off the shelf code and hardware interfaces for decoding your SMPTE or
other time codes.
On 5/1/16 1:26 PM, jimlux wrote:
> On 5/1/16 12:26 PM, Bill Baker via time-nuts wrote:
>> My problem: I'd like some kind of off-the-shelf device that can take
>> the time code and switch on or impulse another circuit-- specifically
>> I'd like to trigger a 180 year-old fog bell (I'm a lighthouse nut as
>> well, www.henryisland.com) on the hour and maybe be able to impulse my
>> minute school clocks. I'm not at this group's technical level, so
>> it's got to be pretty easy to program. So I need a box that I can
>> program with SMPTE time in and a timed switch impulse out. Any ideas?
>> Many thanks,
>> W1BKR
>
> An Arduino or Teensy (http://www.pjrc.com) are both trivially easy to
> program and have easy interfaces (With a large number of off the shelf
> interface widgets like relays, optoisolators, etc.). There's probably
> off the shelf code and hardware interfaces for decoding your SMPTE or
> other time codes.
>
In fact
http://forum.arduino.cc/index.php?topic=8237.0
https://hackaday.io/project/7694-arduino-timecode-smpte-ltc-reader-generator-shield/log/27289-stripped-down-ltc-reader-code-for-arduino
references someone decoding SMPTE from an audio signal.
But are you sure you want SMPTE... Do you have a source already?
Seems to me you'd want something like a GPS receiver.. equally easy.
I've got code the reads a Garmin GPS-18 on a teensy somewhere around,
and I'm sure others have stuff for basically any GPS receiver made.
Lately, i've just been logging 1pps from various sources using the teensy.
After all, don't you want your fog bell to be accurate to fractions of a
microsecond, because otherwise you're not really a time-nut <grin>.
CA
Chris Albertson
Mon, May 2, 2016 1:14 AM
My problem: I'd like some kind of off-the-shelf device that can take the
time code and switch on or impulse another circuit-- specifically I'd like
to trigger a 180 year-old fog bell (I'm a lighthouse nut as well,
www.henryisland.com) on the hour and maybe be able to impulse my minute
school clocks. I'm not at this group's technical level, so it's got to be
pretty easy to program. So I need a box that I can program with SMPTE time
in and a timed switch impulse out. Any ideas?
I assume you only need to be accurate to within about 1/10th of a second or
so. Any general purpose computer like and old PC can do this but today
you'd go with a Raspberry Pi 2 or some other single board computer. The
first step is to keep the computer's internal clock in sync with your time
signal (NTP can do that and NTP will likely already be installed on the
computer) then if the computer is running a Unix-like OS (such as Linux,
BSD or Mac OS X) there is a table you can set up that will run various apps
at certain scheduled times. You'd simply set s cron tab entry to blow the
horn on every hour every hour. Not much software to write as this kind of
stuff (syncing to an external clock and doing things on a schedule) is
built in to the OS.
OK if you need to be much more accurate it gets harder but really this is a
audio alarm and the speed of sound is very slow such that the delay you'd
experience from sending 100 feet from the fog bell is longer than the delay
introduced by the software
So yjr only thing you need is to write software that does just one thing,
ring the bell then quit and let "crond" call it based on entries from the
table.
I see suggestion to use an Arduino or the like and program it. That could
work too but if the little computer is powerful enough to run a unix-lil OS
you save some effort because they already come with built-in utilities to
do things on a schulue and to stay sync'd with an external clock signal.
Chris Albertson
Redondo Beach, California
On Sun, May 1, 2016 at 12:26 PM, Bill Baker via time-nuts <
time-nuts@febo.com> wrote:
> My problem: I'd like some kind of off-the-shelf device that can take the
> time code and switch on or impulse another circuit-- specifically I'd like
> to trigger a 180 year-old fog bell (I'm a lighthouse nut as well,
> www.henryisland.com) on the hour and maybe be able to impulse my minute
> school clocks. I'm not at this group's technical level, so it's got to be
> pretty easy to program. So I need a box that I can program with SMPTE time
> in and a timed switch impulse out. Any ideas?
I assume you only need to be accurate to within about 1/10th of a second or
so. Any general purpose computer like and old PC can do this but today
you'd go with a Raspberry Pi 2 or some other single board computer. The
first step is to keep the computer's internal clock in sync with your time
signal (NTP can do that and NTP will likely already be installed on the
computer) then if the computer is running a Unix-like OS (such as Linux,
BSD or Mac OS X) there is a table you can set up that will run various apps
at certain scheduled times. You'd simply set s cron tab entry to blow the
horn on every hour every hour. Not much software to write as this kind of
stuff (syncing to an external clock and doing things on a schedule) is
built in to the OS.
OK if you need to be much more accurate it gets harder but really this is a
audio alarm and the speed of sound is very slow such that the delay you'd
experience from sending 100 feet from the fog bell is longer than the delay
introduced by the software
So yjr only thing you need is to write software that does just one thing,
ring the bell then quit and let "crond" call it based on entries from the
table.
I see suggestion to use an Arduino or the like and program it. That could
work too but if the little computer is powerful enough to run a unix-lil OS
you save some effort because they already come with built-in utilities to
do things on a schulue and to stay sync'd with an external clock signal.
--
Chris Albertson
Redondo Beach, California
CA
Chris Albertson
Mon, May 2, 2016 1:30 AM
But are you sure you want SMPTE... Do you have a source already?
You don't need GPS or SMPTE if you have an Internet connection. The
computer can use a set of NTP servers from the "pool" to get time. The
result is good enough that the seed of sound delay resulting from your
random distance to the bell will be the largest source of error.
If you convert timing errors to distance at the speed of sound. You would
need the GPS only if you car about bell to ear distances of about one foot,
give or take
So for this use case the OP does not need a GPS or even a SMTPE connection
just a WiFi link to the internet would be more than enough for controlling
a horn blast from a light house
--
Chris Albertson
Redondo Beach, California
> But are you sure you want SMPTE... Do you have a source already?
>
>
You don't need GPS or SMPTE if you have an Internet connection. The
computer can use a set of NTP servers from the "pool" to get time. The
result is good enough that the seed of sound delay resulting from your
random distance to the bell will be the largest source of error.
If you convert timing errors to distance at the speed of sound. You would
need the GPS only if you car about bell to ear distances of about one foot,
give or take
So for this use case the OP does not need a GPS or even a SMTPE connection
just a WiFi link to the internet would be more than enough for controlling
a horn blast from a light house
--
Chris Albertson
Redondo Beach, California
J
jimlux
Mon, May 2, 2016 12:55 PM
On 5/1/16 6:30 PM, Chris Albertson wrote:
But are you sure you want SMPTE... Do you have a source already?
You don't need GPS or SMPTE if you have an Internet connection. The
computer can use a set of NTP servers from the "pool" to get time. The
result is good enough that the seed of sound delay resulting from your
random distance to the bell will be the largest source of error.
If you convert timing errors to distance at the speed of sound. You would
need the GPS only if you car about bell to ear distances of about one foot,
give or take
So for this use case the OP does not need a GPS or even a SMTPE connection
just a WiFi link to the internet would be more than enough for controlling
a horn blast from a light house
However, depending on how much work you want to do, it's easier to
decode the serial stream from a GPS receiver or SMPTE and close a relay,
than it is to set up an internet connection, make sure it's not
vulnerable, etc.etc.etc.
If you already have a PC with a connection, sure, it's straightforward,
but if you're starting from scratch, the work to get the whole internet
software stack up and running particularly on a small cheap board is
substantial.
If you already have a Arduino/Beaglebone/Rpi set up, and safely
connected to the internet, then you could just copy that; but if you've
not done it before, it takes a while.
On 5/1/16 6:30 PM, Chris Albertson wrote:
>> But are you sure you want SMPTE... Do you have a source already?
>>
>>
> You don't need GPS or SMPTE if you have an Internet connection. The
> computer can use a set of NTP servers from the "pool" to get time. The
> result is good enough that the seed of sound delay resulting from your
> random distance to the bell will be the largest source of error.
>
> If you convert timing errors to distance at the speed of sound. You would
> need the GPS only if you car about bell to ear distances of about one foot,
> give or take
>
> So for this use case the OP does not need a GPS or even a SMTPE connection
> just a WiFi link to the internet would be more than enough for controlling
> a horn blast from a light house
>
>
However, depending on how much work you want to do, it's easier to
decode the serial stream from a GPS receiver or SMPTE and close a relay,
than it is to set up an internet connection, make sure it's not
vulnerable, etc.etc.etc.
If you already have a PC with a connection, sure, it's straightforward,
but if you're starting from scratch, the work to get the whole internet
software stack up and running particularly on a small cheap board is
substantial.
If you already have a Arduino/Beaglebone/Rpi set up, and safely
connected to the internet, then you could just copy that; but if you've
not done it before, it takes a while.
MC
Mike Cook
Mon, May 2, 2016 1:49 PM
My problem: I'd like some kind of off-the-shelf device that can take the
time code and switch on or impulse another circuit-- specifically I'd like
to trigger a 180 year-old fog bell (I'm a lighthouse nut as well,
www.henryisland.com) on the hour and maybe be able to impulse my minute
school clocks. I'm not at this group's technical level, so it's got to be
pretty easy to program. So I need a box that I can program with SMPTE time
in and a timed switch impulse out. Any ideas?
I assume you only need to be accurate to within about 1/10th of a second or
so. Any general purpose computer like and old PC can do this but today
you'd go with a Raspberry Pi 2 or some other single board computer. The
first step is to keep the computer's internal clock in sync with your time
signal (NTP can do that and NTP will likely already be installed on the
computer) then if the computer is running a Unix-like OS (such as Linux,
BSD or Mac OS X) there is a table you can set up that will run various apps
at certain scheduled times. You'd simply set s cron tab entry to blow the
horn on every hour every hour.
cron isn’t good enough for < 1s accuracy timing even with a GPS steered clock.
It only wakes up every minute and the time used scanning all crontab tables to see what needs to be run in that minute and scheduling those means that you rarely get a job executed in < 1s of the desired time.
> Le 2 mai 2016 à 03:14, Chris Albertson <albertson.chris@gmail.com> a écrit :
>
> On Sun, May 1, 2016 at 12:26 PM, Bill Baker via time-nuts <
> time-nuts@febo.com> wrote:
>
>> My problem: I'd like some kind of off-the-shelf device that can take the
>> time code and switch on or impulse another circuit-- specifically I'd like
>> to trigger a 180 year-old fog bell (I'm a lighthouse nut as well,
>> www.henryisland.com) on the hour and maybe be able to impulse my minute
>> school clocks. I'm not at this group's technical level, so it's got to be
>> pretty easy to program. So I need a box that I can program with SMPTE time
>> in and a timed switch impulse out. Any ideas?
>
>
> I assume you only need to be accurate to within about 1/10th of a second or
> so. Any general purpose computer like and old PC can do this but today
> you'd go with a Raspberry Pi 2 or some other single board computer. The
> first step is to keep the computer's internal clock in sync with your time
> signal (NTP can do that and NTP will likely already be installed on the
> computer) then if the computer is running a Unix-like OS (such as Linux,
> BSD or Mac OS X) there is a table you can set up that will run various apps
> at certain scheduled times. You'd simply set s cron tab entry to blow the
> horn on every hour every hour.
cron isn’t good enough for < 1s accuracy timing even with a GPS steered clock.
It only wakes up every minute and the time used scanning all crontab tables to see what needs to be run in that minute and scheduling those means that you rarely get a job executed in < 1s of the desired time.
NS
Nick Sayer
Mon, May 2, 2016 3:24 PM
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).
But are you sure you want SMPTE... Do you have a source already?
You don't need GPS or SMPTE if you have an Internet connection. The
computer can use a set of NTP servers from the "pool" to get time. The
result is good enough that the seed of sound delay resulting from your
random distance to the bell will be the largest source of error.
If you convert timing errors to distance at the speed of sound. You would
need the GPS only if you car about bell to ear distances of about one foot,
give or take
So for this use case the OP does not need a GPS or even a SMTPE connection
just a WiFi link to the internet would be more than enough for controlling
a horn blast from a light house
--
Chris Albertson
Redondo Beach, California
time-nuts mailing list -- time-nuts@febo.com
To unsubscribe, go to https://www.febo.com/cgi-bin/mailman/listinfo/time-nuts
and follow the instructions there.
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).
> On May 1, 2016, at 6:30 PM, Chris Albertson <albertson.chris@gmail.com> wrote:
>
>> But are you sure you want SMPTE... Do you have a source already?
>>
>>
> You don't need GPS or SMPTE if you have an Internet connection. The
> computer can use a set of NTP servers from the "pool" to get time. The
> result is good enough that the seed of sound delay resulting from your
> random distance to the bell will be the largest source of error.
>
> If you convert timing errors to distance at the speed of sound. You would
> need the GPS only if you car about bell to ear distances of about one foot,
> give or take
>
> So for this use case the OP does not need a GPS or even a SMTPE connection
> just a WiFi link to the internet would be more than enough for controlling
> a horn blast from a light house
>
>
> --
>
> Chris Albertson
> Redondo Beach, California
> _______________________________________________
> time-nuts mailing list -- time-nuts@febo.com
> To unsubscribe, go to https://www.febo.com/cgi-bin/mailman/listinfo/time-nuts
> and follow the instructions there.
J
jimlux
Mon, May 2, 2016 4:51 PM
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).
Or just buy a DC controlled solid state relay.. The NPN open collector
current booster might be nice still, but the SSR takes care of all the
galvanic isolation, etc.
The real question is whether "cron" is timely enough. No matter, just
write a script (or python) that reads time in a loop (and you can put a
sleep in there) and pulses the GPIO when needed.
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).
>
Or just buy a DC controlled solid state relay.. The NPN open collector
current booster might be nice still, but the SSR takes care of all the
galvanic isolation, etc.
The real question is whether "cron" is timely enough. No matter, just
write a script (or python) that reads time in a loop (and you can put a
sleep in there) and pulses the GPIO when needed.
J
jimlux
Mon, May 2, 2016 4:56 PM
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.
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.