I made a project about servo positioning according to the some inputs via nano board. It was running and there was not any trouble.
Lastly, I added a Dwin HMI to my system via serial communication for entering and checking some parameters from screen. When I activated this HMI hardware communication (pin 2 & pin 3) at void setup (), servos are becoming abnormal situation. They are twitching and can not go to set position. When I delete the new serial expression from software, they becomes normal. What can be the reason? Is there any idea or suggestion?
Thanks in advance.
I dont have any schematic about this project. I connected them on breadboard. I made all single point connection. Voltage supllier (5V) and GND's are common for all parts. Arduino, servos, and HMI's GND are connected to each other by single point connection.
The power supply is inadequate. Use a separate power supply and budget 1 Ampere per servo for small ones like SG-90 and 2.5 Amperes/servo for MG996R. Never use the Arduino 5V output, as that can damage the board.
Yes, i am using seperate power supply for this system. I am using 10 A 12v- 5v voltage regulator and feed all parts from this regulator seperately. Gnds are common.
Basically, my schematic is this. Breadboard current capacity is 1 A almostly. SG90's current capacity is 220 mA. So it should be enough for this system. I am already powering HMI from power supply unit directly.
But suspicious point is this: when I cancelled hardware serial, system runs normally. Does the new serial communication cause over power consumption? Or is the problem related with software because of new serial communication?
I will try to cancel new defined software serial and try to send/receive data from Dwin by existing soft serial with Rx0 Tx1 pins.
Yes it was also additional software serial. I wrote it wrong also.
Now, I cancelled new defined software serial and tried it with existing softserial via Rx0 and Tx1. It is running normally.
When I add new softserial to my system as Rx2 and Tx2, somehow it makes noise or something like that. I could not understand the reason.
Hım ok. I was thinking as they are soft.
Actually, i did not make any definition about that pins as software serial. I changed mySerial.write//read parts as Serial.write/read. And i replaced dwin RX TX cable from pin2&3 to pin0&1 and it works.
Jim is correct, the simplest solution would be to not use SerialMonitor, and use the hardware serial for your terminal. Does make debugging an order of magnitude harder, though.
Other alternative would be to switch to some other Arduino, like a Mega, or Every, that have multiple hardware serial.