Hello, I’ll explain what the code below does or drives.
I have an Arduino Pro Mini, connected to a 3.7v 950mAh battery (protected) and a 5v 400mAh solar panel.
I have an SD card module connected directly to the Arduino.
There is an RTC, Humidity and Temp sensor, Barometer and a simple light sensor thing connected to a MOSFET.
The MOSFET activates and deactivates every 2 minutes or whenever the loop runs if the Arduino is not sleeping.
Basically, records data to the SD card. Everything seems to be working fine but, I don’t know what happens that the software or hardware causes the Arduino to Freeze or hang and it will remind like that until I press reset button.
How the outside looks when the micro controller is hang/frozen: The Arduino gets ‘stuck’ with the MOSFET on HIGH, allowing all the modules to be on, thus drawing power. Is it my sleep code? I don’t think it is a MOSFET problem because otherwise the serial data port also stops sending to my pc.
I took a lot of the code from one of Nick’s projects which I understand to some extent. MOSFET used is a TIP31 and the reason for it is that not only do not know which to use, but it the only one I have, literally.
Any recommendations for a MOSFET that fits 0 to <5v? Voltage ranges from 3.3v to 4.2v.
I had to include the code as a file because I exceed the maximum allowed length…