I have made a 2 wheeler car with an ultrasonic sensor for obstacle detection and 2 IR sensors for lane detection however the ultrasonic sensor initially gives off valid reading but then randomly starts glitching. Moreover when i removed the ultrasonic sensor and only used the IR sensor and motors the motors started glitching like randomly stopping reversing etc
I checked and rewrote the whole code but now my car wouldnt turn left of right...plus it very glitchy
I have used l293d h bridge as motor driver 4 1.5v battery for motors and a 9v battery for arduino
Welcome to the forum
Please post your sketch, using code tags when you do
Posting your code using code tags prevents parts of it being interpreted as HTML coding and makes it easier to copy for examination
In my experience the easiest way to tidy up the code and add the code tags is as follows
Start by tidying up your code by using Tools/Auto Format in the IDE to make it easier to read. Then use Edit/Copy for Forum and paste what was copied in a new reply. Code tags will have been added to the code to make it easy to read in the forum thus making it easier to provide help.
Also post a schematic of your project showing all components, how they are interconnected and powered. A picture of a pencil and paper drawing is good enough
Which type of 9V?
That motor controller is a very low power type. How big is the car?
Idk it’s probably the pp3
It’s a big box like battery with a circular and a hexagonal pin
That left floating pins which the program tries to interpret.
Insufficient for the two motors, and other devices. Get a 6 cell AA battery holder for 9vdc to replace the "box like battery"... the AA battery supply will work for much longer than the PP3, but will eventually run out of power.
I m using 9v battery for the arduino
Whilst the arduino does not draw much power you also power the ultrasonic sensor and the two IR detectors from that 9V battery. You probably draw close to 100mA. That’s already a lot for such batteries which are really meant to power smoke detectors types of electronics.
Your arduino regulator needs ti bring down the excess 4V to reach 5V for its operation, so you dissipate in heat (lost power) 5V x 100mA = 0.5W … not good for the planet and your system…
When your battery is depleted, it won’t be able to provide enough power and the voltage will drop below the minimum 7V that are needed and the arduino will start acting weird.
Before incriminating other components (which is still a possibility) I would double check if you get the same hectic behavior if you power by USB or a better battery
Sorry, you are joking, you don't know what type of battery it is.
Google; PP3.
It's a big box like battery?
If it isn't this type of battery, please post an image.
Tom...
![]()
yea its this this type...mb i wasnt sure ![]()
yes i get those erratic behavior when connected to USB but its far better when i connect it to a battery
Hi, @logiuse5677
As asked before.
Please post your code.
This link will help.
A schematic would also be good as well as some images of your project.
Those PP3 are for DMM and smoke detectors.
Not the sort of load like your robot.
Tom..
![]()
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.

