Hi,
Any help into this issue would be greatly appreciated.
Ok so in light with my sem 1 project, I was tasked to build a robot car that can do the ‘line tracking’ using 2 infrared sensors attached to the front. Then, at the end of the line, there would be a small table with a small wall in front whereby I need to AUTONOMOUSLY pick up a load using a servo-powered gripper. With that small wall, I then had an idea of using an HC-SR04 ultrasonic sensor. I got a photo of the entire racetrack attached.
I choose to run everything on my car using an L298P motor shield that is placed on top of my Arduino Uno. I also attached a hand-drawn wiring diagram for added reference (sorry im not the best at drawing).
So I then come up with a coding attached (for the sake of simplicity, I would just use one servo for the coding, tho, in reality, there would be like 4 of them, and team UP is my team's name).
Basically, how my coding works is as follows. If my ultrasonic sensor detects a great distance (tho I added in distance > 3000 || distance > 60 || distance > 3 || distance == 0 || distance == 1 too as these are what I call ‘anomaly distances’ my sensor tends to pick up once in a while), my car would still continue to line track. However, when my ultrasonic sensor detects a very very small distance (my car at that time would be close to the small wall I talked about earlier), that would stop the car and activate my gripper (for the sake of simplicity, in the attached coding, I set it such that with the help of a servo, arm would raise up to its 90 deg position, delay a few seconds, then raise down to its horizontal position autonomously).
So, here’s where my problem arises. This coding can only run whenever I connect my Arduino Uno to the computer via a USB cable. But, I want my coding to run only via my 7.4V LiPo battery. In an attached diagram, you can see how I connect my LiPo to Arduino’s power jack by creating this small setup with a barrel jack and a dean connector. And so, I connected my battery in such fashion, and the coding didn’t run as expected. And yes, my battery didn’t run out of power when I tried to do so. This problem still puzzles me.
I want to try to have it so that my coding can still run even with just the LiPo battery alone. Are there any slight flaws in the coding that I have to tweak so that the coding can run like usual? Or maybe I need to change to a different motor shield? Or perhaps some parts of the wiring were wrong? Let me know your recommendations below.
This is one of my first Arduino projects. I know this may be something simple for you out there and hopefully I can learn from you guys. I would sincerely appreciate if you can help me out. Thanks.
team_up_hcsr04_coding.ino (2.8 KB)
wiring scheme for my robot car.pdf (297 KB)