In my last update on the robot car, I had successfully setup wifi control for the car but was struggling with a few issues that need attention. The first issue was the startup behavior of the car. On boot, the right motor would spin really fast for a few seconds. While not a huge deal, it was annoying. The other issue is that the car seemed to be really underpowered, to the point where it wouldn’t even move when driving on carpet.
My assumption regarding the boot behavior was that one of the pins was getting pulled high (or low?) on boot, which was causing the motor to spin. The motor spinning by itself wasn’t a huge issue, but it was pulling a lot of current which caused problems when I was plugged into a laptop to load code (the laptop would do an emergency shutoff of power to the USB port). TO protect against these power surges, I decided it would be a good idea to add a second power switch to the car that I could use to control the motors. This would allow me to load code onto the esp8266 without having to worry about what the motors would do.
Once I had the switch wired up I switched focus to figuring out how to stop the wierd motor behavior. I went back to my old trusty debugging methods and pulled a second WeMos out of the part box and an LED. I loaded the Arduino sketch and proceeded to re-boot the WeMos with the LED connected to each pin. It turns out the D4 pin was getting pulled high on boot, and that was also one of the pins that I was using for motor control. I went back to the robot car and swapped out the D4 pin for a different one, and was happy to see the weird motor issue disappear!
Once I had the boot behavior issue sorted out, and I turned my attention to the motor speed issue. One thing that I thought was curious was that the weird boot issue caused the motor to spin really fast, but when I operate the car normally, the motors spin pretty slow. I played around with the control logic and tested out the speed settings of the motor control board but was only having marginal luck getting the motors to power the car. It would move really slow on hardwood, and would budge a little bit.
After some internet research, I came to a rough conclusion that the motor board controller was throttling the power to the motors to protect them from damage (which is part of the reason you should use the board) and combined with the low power battery source, the friction from the tank treads (the treads ended up being a pretty tight fit) and the fact the motors are cheap toy motors, the robo car was struggling to move on rough surfaces. At some point I will test these assumptions so that I can solve the issue, but after tweaking the code a little bit I was able to get the car to move (albeit very slowly) on the carpet and decided to call it a day.