2

I am wondering if there is a way to write arduino code to ask Ubuntu to shutdown/reboot over serial communication. Basically, I want to use a Bluetooth sensor connected to an arduino, to be able to shutdown the computer. Any help will be greatly appreciated. Thanks.

Aditya

0

OK, so you want to set up a service on the host machine to wait for a shutdown signal, and then shut down.

Run this in Terminal:

sudo echo "cat /dev/ttyS0 
poweroff" > /etc/sbin/sshutdownd
sudo chmod 755 /etc/sbin/sshutdownd

And then just run this at boot (you can throw it in an init.d script if you want):

nohup /etc/sbin/sshutdownd &

On the arduino, just send a return carriage on the serial line, and the system will shut down.

  • Hey, thanks a lot! one more question. What is a return carriage, and how do i send it via an arduino? – Adi Jul 23 '15 at 17:28
  • The equivalent of pressing enter. – Daniel Jul 23 '15 at 20:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.