Hi everyone! I'm a first year automotive stundent and for out final project we are building an RC car using arduino. Being a real fanatic and enthusiast, I took it to the next level by purchasing a Lamborghini RC for it's motor and body. The RC ran on 5 1,5V AA batteries in series and was about 10kph fast (manufacturer claim).
For my own build I'm using the factory DC motor with a L298N h-bridge, a Mega2650,a joystick, 1 sonar sensor, an nrf24l01 transmitter and a sg90s servomotor. I will be adding an RFID reader, 1 extra sonar and I will be replacing the sg90s with the mg90s plus the Mega with a NANO V3 for packaging purposes. While working on my desk, the arduino connected to the pc and the supposed 7,5V (the 5 AA in series) cell pack connected to the Hridge which then of course connects to the arduino via Vin, everything was fine. Wheels were spinning, servo was working and all was well.
(Quick question in between. The VCC and GND from the L298N MUST connect into the arduino vin and gnd right? when I used separate batteries for the board and bridge, without connecting vcc to vin, my motor was dead. Is that normal?)
When I disconnect the arduino from my PC and just leave it with the supposed 7,5V into VCC into Vin and GND, and put the car on the ground to actually toy around with it, life gets a bit harder. Its like the car can't carry its own weight. It can (somewhat) go forward and backward, but there is no possibility of me using the joystick to turn via the servo and still go forward. When i try to do that, it just 'freezes'. Plus, everything is extremely slow, even though the motor is set to spin at int 255 at full joystick extension. In the air however, the wheels spin at their respective speed and I can use all controls at the same time. After this fiasco I connected a 9V battery into VCC of the ln298n and gnd. So now it was the supposed 7,5V and 9V in VCC together, both grounded of course (current build sketch). Again, the car wasn't able to pull it's weight, it was a bit better though. In the air, all was well. Actually, that's not true, even in the air it used to 'freeze' without the arduino connected to my PC.
Since it's 3AM right now, I will be going to the store and buy all new 9V and 1,5V batteries in the morning. They could just be 'empty' from the tens of hours of coding and testing. I will also get my multimeter back from my girlfriend to be able to monitor whether I'm actually at the Voltage I think I should be at or not.
The DC motor also has a quite annoying whine to it. I don't know why that is, but when the motor is turned off, dig.write.LOW for both, its silent. Turning the joystick also increases this whine. When connected to a 9V battery directly though, nothing, silent as ever.
With all this given information, could you please recommend me a good power setup? I'm not exactly sure how I should wire the power cables and with what (size) batteries to get the max out of my motor and not blow up my board. I read that the n298 can handle up to 30-ish Volts and the Mega up to 12 safely. I'n not sure whether more volts on the motor directly translate into more speed, but if it does it'd be fun to be faster. It would also result in a better grade . Thanks in advance everybody!
Here are some basic schematics.