Power Off Board & Rvr

Here’s a snippet of code I did last night. With the Up Board mounted I needed to shut down Linux and power off the Rvr. Fortunately, the (undocumented) Rvr power off command allows a delay in turning off the power. That allows the Up Board to do a shutdown before power is lost.

int main(int argc, char* argv[]) {
    mys::TraceOff terr_off { terr };

    if (argc < 2) {
        tout << "Need serial port defined on command line" << mys::nl;
        return -1;

    SerialPort serial { argv[1], 115200 };
    rvr::SendPacket req { serial };
    rvr::Blackboard bb;

    rvr::Power pow(bb, req);


    return {std::system("sudo shutdown now")};

It takes a file in the /etc/sudoers.d directory. I assume this will work in a Pi. Run:

sudo visudo -f /etc/sudoers.d/shutdown

Add the line:

<user> ALL = (root) NOPASSWD: /sbin/shutdown

That disables the need for the password but you
still have to type sudo.

The command line takes the serial port as an argument:

./rvrPowerOff /dev/ttyS4

It looks like the nodejs SDK does not have an endpoint for power off, I didn’t know that command existed! I’ll open up a github issue for it. Its neat that you can add a delay to the shutdown.

1 Like

I got the serial API information in a message here. I asked because the Edu app has the ability to turn off power.

1 Like

I explored the internals of the SDK, there’s not even a hint of the power command lol. Really highlights how cool your c++ project is! Side note, I got my raspberry pi 3b+ powered off of internal power :smiley: no idea what the problem was with that. I’m getting sensor streaming comparable to your streaming rates now!

1 Like

Power off is a Power device ((0x13) with a command byte of 0x00 followed by a byte which is the time delay sent to the Nordic processor (target 0x01).

1 Like

Its a shame the documentation isn’t a wiki, I bet you have tons of knowledge like that at this point that isn’t publicly available. Saving this reply for when I want to take a stab at forking the repo and adding my own commands. Thanks!

1 Like

Here’s my overall Wiki and my code.

Code is up to date but the Wiki needs some work.