Switching AUX1-4 via Notehub UI

Hello Blues,

First of all, as this is my first post, I want to say “Well done on the excellent engineering that has gone into your products Blues”.

In my application I want to switch on & off my MCU via the Notehub UI. I have a regulator (a Polulu U1V11F5) that has a shutdown input. The power input to this regulator is the VMAIN pin on my Notecarrier B and the /SHDN pin on the U1V11F5 is connected to the AUX1 pin on the Notecarrier.

As per the instructions for sending notefiles from Notehub UI I send the JSON to my Notecard.

“req”: “card.aux”,
“mode”: “gpio”,
“usage”: [“high”, “off”, “off”, “off”]

The Notecard receives the file on the next inbound sync, and I can read the notefile data.qi via USB, but nothing happens on the AUX pins. It does not go high.

I must have missed something in the documentation as I expected the pin to go high. Can you help please?


Paul Hutchinson

strong text

Hi @hussat and welcome to the Blues community!

This is a great question and I can understand your confusion. You’re trying to send a command to a Notecard from Notehub, and the command you want to send is card.aux. However, instead of sending this command, you sent an inbound Notefile to the Notecard with this command as its body. Since the body can be any arbitrary JSON, you basically just sent a string to the Notecard, and the Notecard doesn’t know to process it as a command. Inbound Notefiles are meant to send data, not direct requests or commands.

When you want to issue commands to override Notecard behavior, I recommend looking at environment variables, specifically the list of reserved environment variables. These can be set in Notehub under Settings.

This is a fairly advanced topic! I recommend going through the Using AUX GPIO Mode docs as I believe what you want to use is the _aux_gpio_set environment variable set to "high,off,off,off”.

Please see Setting GPIO Outputs High or Low with Environment Variables as, for this to work, the Notecard has to have been previously configured with "req":"card.aux","mode":"gpio"....


1 Like

Hi Rob,

Thanks for heading me in the right direction. This is exciting stuff. In our application we have hundreds of legacy 3G devices that are base-stations for our wireless soil moisture sensors. The bases switch on when they register light on their solar panels and stay on as long as that continues for 24 hours. It works well, but with the Notecard features we can switch them on & off remotely. Brilliant - much more sophisticated. We will be able to switch off the bases if our customer do not pay their bills!

I have made progress with the Notehub API, but got stuck on the formatting of the API calls. I’m using the Windows cmd line to test the feature, so your examples don’t work exactly the same as mine. Here is the response from the API to my PUT command to switch on AUX1.

C:\Users\paulh>curl -X PUT -L https://api.notefile.net/v1/projects/app:xxxx/devices/dev:xxxx/environment_variables -H “Authorization: Bearer xxxx” -d “{“environment_variables”: {”_aux_gpio_set": “high,”}}"
{“err”:“malformed request”,“code”:400,“status”:“Bad Request”,“request”:“/v1/projects/app:xxxx/devices/dev:xxxx/environment_variables”,“details”:{“body”:“”}}

Something is wrong with the formatting. Can you see it?