Nathan99
Posts: 29
Joined: Fri Dec 14, 2012 9:12 pm

Detect power On/Off without TX Pin

Sun Jan 26, 2014 6:26 pm

I know you detect when the raspberry pi is running by testing weather the serial TX pin is HIGH but I was wondering if there was any other way of detecting this without the use of the TX pin.

Thanks
Nathan

User avatar
joan
Posts: 12903
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: Detect power On/Off without TX Pin

Sun Jan 26, 2014 6:30 pm

It may be helpful to know what you want to achieve. Personally I don't think sensing that TX is high means that the Pi is "running".

Nathan99
Posts: 29
Joined: Fri Dec 14, 2012 9:12 pm

Re: Detect power On/Off without TX Pin

Sun Jan 26, 2014 6:34 pm

The TX pin is usually used to detect when the Pi is on as it goes high as soon as data is read from the SD and low when the file system is unmounted on shutdown. I will be using the Serial the port on my and I was wondering if there is any other way of detect bootup/shutdown.
Thanks

Nathan99
Posts: 29
Joined: Fri Dec 14, 2012 9:12 pm

Re: Detect power On/Off without TX Pin

Sun Jan 26, 2014 8:36 pm

Any ideas?

User avatar
redhawk
Posts: 3465
Joined: Sun Mar 04, 2012 2:13 pm
Location: ::1

Re: Detect power On/Off without TX Pin

Sun Jan 26, 2014 9:13 pm

There are other slightly less easy methods of detecting the Pi's shutdown status although TX is the best one to use.
If you're using composite video then you could detect the presence of this signal as activity, when the Pi shuts down the video is turned off which would indicate inactivity / shutdown.
Apart from that you could use the GPIO output pins to indicate when the Pi is pending a shutdown so this would require an additional timer circuit with a delay say 2 minutes to be certain the Pi is off.
Another method and slightly dodgy you could tap into the LED indicators via the circuit board for the Ethernet port.
When the Pi has shutdown the LNK light goes out, however if you're using Wifi this method won't work.

Richard S.

Nathan99
Posts: 29
Joined: Fri Dec 14, 2012 9:12 pm

Re: Detect power On/Off without TX Pin

Mon Jan 27, 2014 4:24 pm

Thanks Richard! Yeah the Ethernet LED idea unfortunately won't work as I am using WI-FI. The composite system may work but doesn't the Pi switch off composite after a few minutes if no keyboard input is given?
Thanks for all the advice!
Nathan

User avatar
RaTTuS
Posts: 9630
Joined: Tue Nov 29, 2011 11:12 am
Location: North West UK

Re: Detect power On/Off without TX Pin

Mon Jan 27, 2014 4:44 pm

you can disable to screen blank via editing
/etc/kbd/config
and change BLANK_TIME=30 to 0
How To ask Questions :- http://www.catb.org/esr/faqs/smart-questions.html
WARNING - some parts of this post may be erroneous YMMV

1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe

User avatar
redhawk
Posts: 3465
Joined: Sun Mar 04, 2012 2:13 pm
Location: ::1

Re: Detect power On/Off without TX Pin

Mon Jan 27, 2014 4:58 pm

No the Pi doesn't turn the screen off it actually blanks the screen, but technically there is still a video signal.
You can disable the composite blanking / screen saver though - http://www.raspberrypi.org/phpBB3/viewt ... 75&t=67647

As for a detection circuit feel free to play around with my old design:
Image
Admittedly the number of transistors was probably overkill but nevertheless it worked. :)
The video signal is fed into a 2 transistor stage (Tr1 + Tr2) to amplify the video buzzing tone, this is then rectified (AC to DC) using diodes D2 and D3 which feeds the capacitor.
When video signal is present the capacitor starts to charge up and voltage gradually increases, when no signal is present the capacitor gradually discharges and voltage decreases.
The voltage output is fed into a transistor based Schmitt trigger arrangement (Tr3 + Tr4), when the voltage rises to the set threshold the Schmitt trigger turns on the LED and off when the voltage falls below the set threshold.

Richard S.

Nathan99
Posts: 29
Joined: Fri Dec 14, 2012 9:12 pm

Re: Detect power On/Off without TX Pin

Mon Jan 27, 2014 7:37 pm

Again thanks for all the advice. I will definately take a look at your circuit Richard. I assume that the TX pin is only way to detect via GPIO?

Nathan

User avatar
redhawk
Posts: 3465
Joined: Sun Mar 04, 2012 2:13 pm
Location: ::1

Re: Detect power On/Off without TX Pin

Mon Jan 27, 2014 7:51 pm

The TX pin is the only pin on the GPIO that indicates the running state of the Pi from what I can tell.
Checking the composite video signal seems to be the second best method although it requires a more involved circuit.

Richard S.

Nathan99
Posts: 29
Joined: Fri Dec 14, 2012 9:12 pm

Re: Detect power On/Off without TX Pin

Mon Jan 27, 2014 8:01 pm

Thanks everyone. Looks like it will have to be composite or just a timer and a python script.

Thanks again
Nathan

User avatar
joan
Posts: 12903
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: Detect power On/Off without TX Pin

Mon Jan 27, 2014 8:15 pm

It may just be me but on my Pi's gpio28 is set to ALT2 after boot. This pushes out a PCM clock at a pretty high rate.

I don't know why that is. I don't knowingly do anything with PCM.

hampi
Posts: 223
Joined: Fri May 31, 2013 11:29 am
Contact: Website

Re: Detect power On/Off without TX Pin

Mon Jan 27, 2014 9:38 pm

Easiest way is probably to check whether the Rpi has 5 V supply on or if you read a voltage close to zero from the power supply line. These two states can be easily distinghuised with a comparator circuit.

Yes I know that you were talking about "halt" state here and not about the power off state.

Nathan99
Posts: 29
Joined: Fri Dec 14, 2012 9:12 pm

Re: Detect power On/Off without TX Pin

Tue Jan 28, 2014 3:29 pm

Aren't "halt" and "power off" (the commands) both technically the same?

User avatar
redhawk
Posts: 3465
Joined: Sun Mar 04, 2012 2:13 pm
Location: ::1

Re: Detect power On/Off without TX Pin

Tue Jan 28, 2014 3:38 pm

I believe they are the same, also the "power supply line" as previous poster called it won't be helpful even in shutdown mode +5v still remains at the USB ports and GPIO +5v supply rail because they're hard-wired to the F3 polyfuse.

Richard S.

Return to “General discussion”

Who is online

Users browsing this forum: mahjongg, mikerr, PeterO, snielsen and 44 guests