# Can I use the Notecard to turn my Raspberry Pi on and off?

**URL:** <https://discuss.blues.com/t/can-i-use-the-notecard-to-turn-my-raspberry-pi-on-and-off/220>\
**Category:** Notecarrier Pi\
**Created:** [April 27, 2021, 1:28pm UTC](https://discuss.blues.com/t/can-i-use-the-notecard-to-turn-my-raspberry-pi-on-and-off/220 "2021-04-27T13:28:02Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![gwolff](https://avatars.discourse-cdn.com/v4/letter/g/a88e57/32.png) [@gwolff](https://discuss.blues.com/u/gwolff)\
**Post date:** [April 27, 2021, 1:28pm UTC](https://discuss.blues.com/t/can-i-use-the-notecard-to-turn-my-raspberry-pi-on-and-off/220/1 "2021-04-27T13:28:02Z")

</div>

I would like to have the ability to remotely control the power to my Raspberry Pi.

1. Is this possible?

2. Can I do it using the Notecarrier Pi

---

<div class="post-metadata">

**Author:** ![gwolff](https://avatars.discourse-cdn.com/v4/letter/g/a88e57/32.png) [@gwolff](https://discuss.blues.com/u/gwolff)\
**Post date:** [April 27, 2021, 2:11pm UTC](https://discuss.blues.com/t/can-i-use-the-notecard-to-turn-my-raspberry-pi-on-and-off/220/2 "2021-04-27T14:11:49Z")

</div>

# Yes, but you cannot use the Notecarrier Pi for this

There are a couple of reasons:

1. The Notecarrier-Pi is powered by the header pins from the Raspberry Pi

2. The Notecarrier Pi [wires](https://dev.blues.io/hardware/notecarrier-datasheet/notecarrier-pi/#pi-40-pin-header-pin-usage) the ATTN Pin to GPIO6 on the Raspberry Pi (pin 31 on the header). It also uses I2C for communication between the Raspberry Pi and the Notecard.

You could use any other currently available Notecarrier such as the [Notecarrier AL](https://dev.blues.io/hardware/notecarrier-datasheet/notecarrier-al/)

# Use the Notecard ATTN Pin

This will require some hardware development.

| | |
| --- | --- |
| `NOTE` | Raspberry Pi is not generally considered for low power applications. You may want to consider using a different host processor that is better suited for low power applications. See [Host Power Management](https://dev.blues.io/reference/notecard-walkthrough/low-power-design/#host-power-management) for more about using Notecard to control the host MCU power state |

The [ATTN pin](https://dev.blues.io/hardware/notecard-datasheet/note-wbex-500/#pin-definitions) on the Notecard can be configured to change state depending on changes to Notefiles, timeouts, cellular connection status, location updates, and motion.

> **[card Requests - API Reference - IoT Connectivity at Blues](https://dev.blues.io/api-reference/notecard-api/card-requests/)**
>
> Notecard provides a number of requests that can be used to configure its behavior, pins, use of GPS and accelerometer data, and to query the state of the device, its network connection and peripherals.

That is, you can configure the ATTN pin to go HIGH if it receives a Note in a specific QI-Notefile. In this case we will make up a name “wakeup.qi”

```auto
{"req":"card.attn","mode":"arm, files","files":["wakeup.qi"]}

```

This will set the ATTN pin LOW.

When the Notecard receives changes to “wakeup.qi” from a sync with Notehub, it will set the ATTN pin HIGH.

## Hardware Configuration

The part I’m a little unclear about the “best” way to wire this up. It will depend on your application and experience with Raspberry Pi and hardware development.

### Control Power Directly Option:

You could wire it directly to a transistor, relay, or opto-isolator that gates the power supply to the Raspberry Pi.

This means:

- power is only applied to the Raspberry Pi if the ATTN pin is HIGH
- power will be disabled after issuing the `card.attn` request above.

Straight forward, but it prevents you from using the ATTN pin for other purposes.

### The RUN Pin:

You could wire the ATTN pin to the RUN pin on the Raspberry Pi.  
I’m not sure of all of the implications here. I believe it is similar to the “control power directly” option listed above

> **[Waking Up Raspberry Pi Using Reset Pin](https://scribles.net/waking-up-raspberry-pi-using-reset-pin/)**

### Soft shutdown/restart Pin:

You could wire the ATTN pin to GPIO3 on the Raspberry Pi.  
This is not particularly well documented, but this pin can by used to “wake up” a Raspberry Pi that has been disabled using a soft shutdown. I don’t believe this entirely powers down the Raspberry Pi.

> **[(...) — Raspberry pi powerdown and powerup button](https://www.stderr.nl/Blog/Hardware/RaspberryPi/PowerButton.html)**
>
> Blog post — Raspberry pi powerdown and powerup button

In this case, I believe you would need to invert the logic of the ATTN pin with some gates.

GPIO3 on the Raspberry Pi shares functionality with the I2C communications. So if you use this method, you will have to use the UART RX/TX lines for Raspberry Pi to exchange messages with the Notecard.

The advantage here is you could potentially use the ATTN pin to react to other events while the Raspberry Pi is powered on, and not be limited to just the wakeup event request.

---

<div class="post-metadata">

**Author:** ![ajlennon](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.blues.com/ajlennon/32/152_2.png) [@ajlennon](https://discuss.blues.com/u/ajlennon)\
**Post date:** [April 27, 2021, 9:47pm UTC](https://discuss.blues.com/t/can-i-use-the-notecard-to-turn-my-raspberry-pi-on-and-off/220/3 "2021-04-27T21:47:01Z")

</div>

Great piece thanks. Very helpful although I’ve battled through most of this over the past week!

Currently trying to make this work with the ATTN pin…

> **[USB Power Switch by 8086 Consultancy on Tindie](https://www.tindie.com/products/8086net/usb-power-switch/)**
>
> Turn your USB devices on/off using a remote switch or Pi/Arduino/etc.

---

<div class="post-metadata">

**Author:** ![ajlennon](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.blues.com/ajlennon/32/152_2.png) [@ajlennon](https://discuss.blues.com/u/ajlennon)\
**Post date:** [April 27, 2021, 9:54pm UTC](https://discuss.blues.com/t/can-i-use-the-notecard-to-turn-my-raspberry-pi-on-and-off/220/4 "2021-04-27T21:54:49Z")

</div>

The other way you can skin the cat is what I was doing, which is to power through the Witty Pi 3 Mini which then powers both the Pi and the Note/Carrier based on an alarm event

> **[Witty Pi 3 Mini - RTC + Power Management for Raspberry Pi Zero](https://thepihut.com/products/witty-pi-3-mini-rtc-power-management-for-raspberry-pi-zero)**
>
> Witty Pi is small electronic circuit board that can add a real-time clock and power management to your Raspberry Pi. The Witty Pi 3 Mini is a new member of the third generation of Witty Pi, and it has pHAT shape (Raspberry Pi Zero size). Features The...

The problem I see with this is that I don’t believe my NB-IoT Note should be turned off. The modem is designed to be left on in low power and it can’t be a good thing to be dropping off the network randomly/periodically due to power loss.

In fact the events I was seeing were somewhat bothering me really, I see you’re sending texts when there’s a power cut…

 ![image](https://us1.discourse-cdn.com/flex020/uploads/blues/original/1X/7ba87c5781f1a207a3887f2b7e12393cf4929b37.png)

Now I think if I was going to carry on with the Pi carrier what I could do is separate the power pin from the bus and instead connect it to the power out bergstick header from the Witty which I think would leave the Note on all the time. Haven’t looked at that as I am going to move over to a NoteCarrier A instead I think.

---

<div class="post-metadata">

**Author:** ![ajlennon](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.blues.com/ajlennon/32/152_2.png) [@ajlennon](https://discuss.blues.com/u/ajlennon)\
**Post date:** [April 29, 2021, 9:46am UTC](https://discuss.blues.com/t/can-i-use-the-notecard-to-turn-my-raspberry-pi-on-and-off/220/5 "2021-04-29T09:46:44Z")

</div>

Here’s a quick video I did on powering a Pi Zero via the `ATTN` pin

[![](https://us1.discourse-cdn.com/flex020/uploads/blues/original/1X/c249ed0870f74c39c7f55f89c8fc0d2df4a2b113.jpeg ""Go Anywhere" Environmental Sensor V2.1 - Creating a Low Power Raspberry Pin with Blues.io "Note"") ](https://www.youtube.com/watch?v=H2nHatnP5-U)
