Hi, my Arduino is driving a GSM SIM800L module via 2 pins and SoftwareSerial.
For power saving, i’m switching the GSM module OFF. I’m hunting any power i can save and i noticed that the TX pin used on the Arduino is sucking about 0.5 mA when the SIM800 is OFF and the Arduino in power sleep.
I tried to switch this TX pin from OUTPUT to INPUT with the pinMode command in my powerdown() function. This effectively solves the current flow problem but when i drive the pin back to OUTPUT when the Arduino wakes up, the serial port doesn’t work anymore…
your design seems to lack a real level shifter with 3-state output betw. the SIM800 and the AVR to switch these level-shifting buffers’ to HiZ when they are off - so that no back-feeding can take place via the serial wires (and internal protection diodes are only betw GND and GPIO!).
Next iteration should contain something like a 74AVC2T245, a TXS0102, or two 74LVC1G125 or a similar level shifter. The 1G125 is available also in SOT23-5. ;)
On the resulting problem (switching the GPIO to input is fine, but doing so while it is under control of SoftSerial messes up the thing):
There is that SoftSerial.end() method (this is also called by the deconstructor). So I’d suggest calling the .end() method before hibernation, and a SoftSerial.begin(<BAUD>) right after awakening (rather than having the latter one only once in the setup() part).
regarding the software part: Not tried, but should work™ ! ;)
You’re right, i don’t have any “serious” level shifter in my design. I first used a SIM900 board with which i didn’t have to worry about. But using a simpler SIM800 brought this problem.
I added a simple voltage divider to “adapt” the levels, the SIM800 serial port using 2.8 V. I wanted to find a software solution before messing with some hardware which is always difficult with a existing board…
I already tried the softwareserial.end and begin solution but that didn’t work. Here what i did :
Softwareserial GSM(RX_PIN, TX_PIN);
In setup()
GSM(GSM_BAUD);
In my power_down() function :
GSM.end();
pinMode (PIN_TX, INPUT);
When it wakes up :
pinMode (PIN_TX, OUTPUT);
GSM.begin (GSM_BAUD);
It effectively switches the ouput pin low reducing the power consumption, but when coming back to life, there is no communication on the serial port…