Nano Every on vehicle 12v, hanging up on vehicle start

As the subject, I have a nano every in a project installed in a RV, powered direct from a tap on the red wire behind the radio, ie fed by chassis/starter 12v battery and switched by the ignition. I figured the Every was designed for vehicle power supply with its wide range. With the key turned on, the Nano runs just fine. I have a heartbeat in the loop to blink the led to indicate its running. 9 times out of ten, after starting the engine, the Nano Every has the power light lit, but the sketch is not running. I even installed the watchdog timer code, but it doesnt help, it doesnt restart, which might indicate its not even running setup AND its not looping. AVR just isnt running at all.

Clearly when the engine is started, the 12v dips very low and the transient brownout results in the AVR not running. Im surprised it doesnt trigger the chip reset properly. It shouldn't be possible to end up in this state. Either the onboard LDO should be smoothed enough to handle the drop, or properly trigger the AVR to reset if its sees this large undervolt drop-out. Instead it seems to be powering the board just fine, the power led is on, but for some reason the sketch isnt running.

Pressing the reset button at this point gets the sketch running just fine as you would expect, and it runs forever while the engine is on, as it should.

Aside from powering it with a 12v-5v buck converter using the micro USB port, which I plan to do, do you have any suggestions or reference circuit showing tried and tested power supply arrangement when using the Nano Every in a vehicle application direct off the vehicle 12v supply, for example off the cigarette lighter? I would guess a huge electrolytic/supercap across the 12v would help, but Im limited on space. How huge is needed? I see the spec says the low limit of supply volts is 6v, so maybe we are going below 6v briefly. But it should trigger reset when the volts recover to 13v when the engine is running. Maybe some external components to trigger a reset are needed?

Hello mtnbrit, do you have the possibility to observe the 12V supply with an oszi to see what is happening on the supply?

Yup, I did it, and learned that most vehicles do in fact cut the ACC power off when cranking the engine. So I need to find a wire with IGN to tap instead of ACC. Then the nano will get constant volts during cranking, just maybe a bit low, like 9-10v, which hopefully it will survive.

Still puzzling why the 1-2 sec power cut causes the Every to end up in a state where its power light is on but its not running code. Anyone have a thought on that?

The power LED is just that an LED connected to the power. If the Arduino is not powered down for long enough then the capacitor in the auto reset circuit will not have long enough to discharge to a point low enough to make the auto reset circuit fire again.

No need for a car just turn off the power for a short amount of time to see that effect, they all do it.

I consider it a design fault in the Nano Every design that the board can be “glitched” into a state where it’s powered but not running. It should reset properly given pretty much any supply drop out, no?

I see the AVR has brown out detect BOD feature. Shouldn’t that take care of this situation? Maybe it’s not enabled by fuses on the nano every? Or needs to be enabled in my sketch?

Normaly this is a job for a watchdog timer. The watchdog has to be triggered at least to a defined time else the watchdog will reset the processor. Please check the Adafriut Sleep Dog Lib. Not sure if the Every is supported.
Adafruit Sleep Dog Lib
Other try: can you load a simple sketch to your Arduino, say the Blinky and then check if the Arduino is working fine in case of power down. Just to ensure it is not a feature of your code. Then observe if the Blinky LED is working fine or not.

No.

Or do you want to pay more for your nano for this rare event? Sure there are reset chips that will do that, any design is a compromise between space, cost and features. If it worries you or you need it then unsolder the reset circuit, one resistor and a capacitor and fit a reset chip.

Have you noticed how many home appliances will hang with a very quick power cycle?

Just because a lot of devices do it, does that make it somehow acceptable?

Im wondering if the BOD feature could be deployed to solve this issue, but its getting deeper into avr fuse programming than I have time for atm. Why wouldn't BOD be set to some safe/reliable value by default?

The Nano Every has an IC (ATSAMD11D14A) that's used for serial communication and programming. It runs on 3.3V and needs the input voltage to drop to about 0.99V to recognize a low state. Your scope trace shows the voltage dipping to only 1.249V. Therefore, the ATSAMD11D14A may not be resetting and if it is, its probably out of sync and locking things up.

I suspect using a buck converter would solve the problem, especially if it cleanly turns off / on during the 12V power dip (or stays on during the dip).

Yes.

Well, this thread is becoming more of journal/saga in how I trouble-shot this issue.

I set up a lab to test the power glitch issue. Used a second Arduino to control a relay inline with the 12v power to the project Arduino. Tested a variety of durations of power drop-outs on the 12v line, and literally could not reproduce the issue. I tested short drops like 50ms, a range of medium durations like 200-800ms, and a range of longer 1 - 2 second dropouts. Every one triggered the board to restart and run the sketch correctly. So, @Grumpy_Mike, the Nano Every reset circuit seems to perform rather well in this regard.

Admittedly, the test conditions are not identical to in my vehicle as the relay drops supply to 0v, not 1.2v as in the RV. So I might pursue the testing with a second PSU connected to switch at 1.2v instead of off and see if it makes a difference to the results.

The 1.2V had me thinking. When the vehicle powers off the ACC line during cranking, it should be 0V. I disconnected the supply wire and found the 1.2v was coming from the Nano, not the vehicle! I was back-powering the board from the steering wheel controller its connected to. Doh!

The vehicle steering wheel controller, powered by the IGN line, stays powered during cranking, and holds its IR data line high at 5V, which I had lazily directly connected to D2 on the Nano. It worked fine all through testing.

So obviously I need to isolate the SWC data line from the Nano using a transistor or opto-isolator. In theory the vehicle is all on common ground, so the transistor should be adequate, but I might go all the way and use an opto to 100% avoid any ground loop.

This back-powering is most probably the cause of the anomalous state the AVR got into, ie not running even though the board had power.

So I added an NPN transistor and series base resistor in front of D2 inline with the input from the SWC, enabled INPUT_PULLUP in the sketch, and tested it in the vehicle. At some point when I was testing it, the Nano power light went off. The fuse had blown. I replaced the fuse, and got the power LED to go on, but the board smelled hot and the sketch wasn't running. Burned my finger touching the chip to see if it was hot. It was! So the back-powering may have damaged the AVR in some way to cause it to go nuclear. ( I see other reports of Nanos going into this mode where they quit working, pull over 8W and get super hot. I will definitely be sizing the supply line fuse correctly for this project, you really dont want a Nano heating up and catching fire behind the dash in your car/RV. Pretty sure insurance wouldn't cover that. )

I will report back once I have built up a new prototype and tested it.

TL;DR; Tip of the day: Opto-isolate Arduinos from other vehicle electronics. Old-hands probably know this, newbie hackers learning things every day.

Understand that there are many devices attached to the automobile accessory 12 volt line and they will attempt to sustain the 12 volts on the wire. To accurately test, you will require those devices to be powered. Think of the number of microcontroller systems in your vehicle. ALL suffer the same as your Arduino and they recover properly.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.