Arduino power supply and data transfer to PC

I am using an Arduino Nano 33 iot, connected with a vl6180x sensor and a stepper motor. The nano is powered by external 5V power supply, while the stepper by external 12V power supply.

I want to transfer in real time data from arduino to the PC (matlab). However: 1. if I initially connect the usb to arduino and pc and then supply the board with external powers, the board does not work, and 2. if I supply the board with external power and then connect the usb to computer, there is a strange behaviour (like the board stalls etc.)

I am thinking of cutting the Voltage wire in my usb cable. Would this be a safe connection for the board and the computer?

Thanks in advance,
LK

Then you posted in an incorrect category. Nano 33 IoT is not a Classic Nano. I have moved your post for you but please take care in future.

Can you disconnect the external 5V power when connecting USB?

A picture of a hand drawn wiring diagram would help a lot.
You can probably safely remove the external 5V PSU, the TOF sensor doesn't use that much power IIRC. In any case you are correct that having both is problematic. As you suggest your approach of removing the 4VDC from the USB is the best solution.

1 Like

Yes but probably unnecessary.

so what would you recommend?

Thanks in advance.

As @PaulRB asked, do you actually need external and USB power connected at the same time?

I do not want to power the whole circuit from arduino and from pc. just for safety.

There is more to the 5V part of the circuit that you have not described? From what you have described to us so far, no problem using the USB as 5V supply. The Arduino, the sensor and logic circuit of the stepper motor driver will not need much power. The motor will continue to take its power from 12V supply when the rest is powered from USB.

normally the circuit should be able to work autonomously, without a pc. I am connecting the pc just when I want to collect data from the circuit to pc.

Well I'm not sure that cutting the USB 5V power wire will actually address your safety concerns.

What are you worried about.

The circuit operates normally when powered via the external power supply (and disconnected usb). However, connecting the USB sometimes causes the system to stall or behave unpredictably. Once the USB is connected successfully without causing a fault, the circuit continues to function as expected.

searching in the net, I believe that the problem is the dual power supply and/or the common ground across the 2 power supplies.

Then cutting the USB 5V power wire won't solve that problem.
What you need is a USB isolator.

1 Like

In such cases I use a Serial connection to standalone USB-UART module with shared grounds, but without the power line.
You also can fully avoid unwanted connection to PC by using wireless UART modules like HC-12 or JDy-40.

1 Like

As I said before, the problem comes with the order of connecting the PC and powering the board:
1. If I first power the board and then connect the USB, strange things happen (even sparks some times).
2. If I connect the USB first and then power the board, the board doesn’t start. This seems to be because the Arduino gets powered from the USB, but there’s no power supply for the motor at that time—so when I flip the board’s power switch to ON, the board fails to start properly.

That’s why I’m considering cutting the USB power line. This should prevent issue (1), and once the board is powered separately, it should start normally—avoiding issue (2) as well.

Thanks.

Have I missed where you posted the links to those supplies?

That doesnt sound good. Have you checked between the grounds with a meter to ensure they are able to be connected together?
Time I think for a diagram

The 33 Iiot does not have a power switch.
There is obvioulsy more to your set-up then you are telling us.
Perhaps if you provide a wiring diagram we can help diagnose your problem.

This is a schematic of the board. I just have a power switch to the 220V of the power supply .

The power supply outputs 12V for the stepper, 5volts for Arduino Vin, and then a 5V to 3V3 converter for logic levels.

As I previously stated, my recommendation is to use a USB isolator with the 33 iot.

1 Like

I removed the power line from the usb cable and since now it seems to work fine.

I will let you know if something changes.

Thanks you!

1 Like