Cutting power to a 4g HAT

Hi there,

I have a Waveshare 7600 G-H M2 HAT attached to a Raspi 4B

Im trying to optimise power consumption and cutting the power to the modem during a specific time frame would be ideal. I notice on the pinout definition (Link above) there is an option to switch the 4g module off/on via gpio pin. Due to my inexperience and failure to find any material online in which is clear to me, i need help in realising how to do it.

I assume this only cuts power to the 4g module only, if there was a way to disable power to the entire HAT via a pin, that would be better. So far everything i have read suggest that is not possible.

Any ideas welcome.
I appreciate your time.

Cheers
Tom

Hi Tom, welcome back!

I took a look at the schematic, and it seems unfortunately that the ENable pins of the extra ICs aren’t connected to anything (i.e. always on).

From my guesses though, the modem uses so much more current (500mA according to the HDM) Waveshare considered the other standby currents negligible in comparison. (especially when compared with the 1.8A or so the Pi might need when working hard).

What were you using this one for that requires power saving like that? Keen to hear about your project!

Hi James,

Thanks for your response.

I’m using the Pi as a bird call recogniser using Birdnet Pi. My original intention was to have real time notification and daily google drive sync. Due to excessive power usage i am now just wanting to switch the modem on once a day to sync google drive before shutting down. I have also scheduled the USB power bus to turn off along with the software. The modem is clearly a big draw and i guess may need to be downsized to one that doesn’t draw as much. My current power solution is a AGM 22 ah battery with a 12 to 5 v converter, solar charged. The original plan was a normal office works power bank but i couldn’t work out how to solar charge it. Any ideas on a modem that would have less draw ? or another way i could somehow schedule it to turn off ?

Cheers
Tom

Hi Tom,

What sort of current measurements are you seeing? I’m reading that the sleep usage of the modem is all the way down at ~2mA, and idle is only ~22mA which is much lower than what the Pi would be idling at. My point is only that another modem may not have the the effect you were looking for.

Hi James,
I hadn’t got around to testing current, i was just trying to optimise where possible.
Would there be a way to schedule the modem to sleep via a cronjob?. Or would it enter sleep if there was no data in/out ? Sorry for my ignorance.
Attached is a image in which identifies a pin (d5) i which can turn on/off the modem. How would this happen ?

Cheers
Tom

Hi Tom,

It would likely go into the idle state with no traffic, but IME there are usually things that constantly keep the modem active to check on things, so you’re on the right track looking to put it to sleep.

The only problem is that it isn’t clear whether pin D5 is connected to the GPIO to its right. I think that is done by way of this DIP switch (ignore the pink):

One way I thought of would be AT commands to the modem to turn networking on and off:
image

That’d get you most of the way there, regardless of driving pins high and low.

As for doing that on a cron job, there are many ways to toggle GPIOs depending on which language you are using. Is this in a bash, C or python script? (guessing Python since you’re doing birdNET stuff

Hi James,
AT commands look promising, providing i can schedule them in a cronjob ? Would it be possible to write a script to get the network to close / open using AT commands and then run that script in a cron job ?
I have started this project with zero knowledge, i have been using Bash so far mostly, but manipulated a few python scripts here and there.
Python is definitely on the to-learn list.

Cheers
Tom

1 Like

Hi Tom,

If you’re on bash, it looks like the simple linux “everything is a file” philosophy works, provided you get the serial port:

Hi James,

Thanks for your help.
Have managed a solution.

Cheers
Tom

Hi Tom, may I ask which solution have you found?

Thanks

Hi Marco,

Welcome to the forum! It’s been a while since this topic was touched so I’m not sure if James or Tom will get back to you.

James has laid out a possible solution. Have you given that one a go?