Best safe practices?

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
Post Reply
User avatar
mathieu
Posts: 88
Joined: Fri Nov 10, 2017 9:57 pm

Best safe practices?

Post by mathieu » Sun Jul 26, 2020 5:37 pm

I have a pyboard-D powered by the 5V output of this step-down voltage regulator and connected to an audio amp, an MPU, and a thread of 144 WS2812 leds potentially drawing several Amperes of current. The pyboard reads data from the MPU and generates sound and light effects in real-time. For debugging purposes right now I have two (probably unsafe) options:
  • switch off the voltage regulator, and connect the pyboard to a laptop using USB, which causes all the power to be drawn from my computer's USB port, at the risk of damaging the board if the amp and/or leds draw too much power
  • leave the voltage regulator on and connect the pyboard to a laptop using USB, but I have no idea how this might go wrong as the two sources of power do not share a common GND.
Generally speaking, what precautions or countermeasures (fuses, diodes...) could I implement to do something like this safely?

User avatar
deshipu
Posts: 1388
Joined: Thu May 28, 2015 5:54 pm

Re: Best safe practices?

Post by deshipu » Mon Jul 27, 2020 1:06 am

mathieu wrote:
Sun Jul 26, 2020 5:37 pm
  • leave the voltage regulator on and connect the pyboard to a laptop using USB, but I have no idea how this might go wrong as the two sources of power do not share a common GND.
They do share a common GND. As soon as you connect them both to the pyboard, their grounds are connected.

User avatar
jimmo
Posts: 2754
Joined: Tue Aug 08, 2017 1:57 am
Location: Sydney, Australia
Contact:

Re: Best safe practices?

Post by jimmo » Mon Jul 27, 2020 3:10 am

mathieu wrote:
Sun Jul 26, 2020 5:37 pm
I have a pyboard-D powered by the 5V output of this step-down voltage regulator
What's powering the buck converter?

So you have two "grounds" -- the negative DC terminal of whatever's powering the buck converter, and also whatever's powering your laptop.

When you connect the pyboard to the laptop, you're now making this a common ground. The question is whether that's safe to do, as they either need to already be the exact same thing (i.e. both tied to earth), or at least one of them floating.

If the laptop is on battery, then there's no problem (i.e. it's floating). So if you want to be really sure, then that's a good way to go.

It's been a while since I saw it, but this video might help -- https://www.youtube.com/watch?v=xaELqAo4kkQ The point there is that your scope ground is not floating, so you need to be careful.

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Avoid floating systems.

Post by pythoncoder » Mon Jul 27, 2020 5:41 am

Laptop wall-warts sometimes have a ground connection, and sometimes do not. In the UK you can usually tell because the earth pin on non-grounded (double insulated) ones is made of plastic. In my opinion non-grounded ones are hazardous for running electronic equipment under test via USB because of static risks. The floating system can build up charge which will suddenly be dumped when you plug in a USB link connected to a grounded PC.

If your Pololu regulator is powered from a wall-wart this may well be ungrounded. Wall warts with a working ground pin are quite rare here.

My approach when testing is to ground everything. For the safety of me and of the equipment. I only use PC's/laptops which are grounded. As @jimmo says, scopes are grounded. I would also ensure that the voltage regulator is grounded, at least while you're testing. Floating electronics is evil: sometimes you have to contend with it, but the occasions when this is truly unavoidable are rare.

There is then the issue of drawing excessive current from the PC USB adaptor. Depending on the connector type this may be limited to 500mA. I don't know a simple answer to this. The cast-iron safe way is to redirect the Pyboard REPL to a UART and to use an FTDI adaptor to link the Pyboard to a PC USB port. You can then ensure that the Pyboard gets its power solely from the Pololu chip: link the grounds but not the 5V pin.

That would be my approach.
Peter Hinch
Index to my micropython libraries.

Post Reply