View: 2795|Reply: 8

Mars Rover Pi Kit B - Motor Comm. Issue

[Copy link]

1

Threads

4

Posts

21

Credits

Newbie

Rank: 1

Credits
21
Post time 2019-6-3 04:45:20 | Show all posts |Read mode
Edited by 1559507739 at 2019-6-3 10:07 AM

Good Afternoon,

I have assembled, reassembled, programmed, and reprogrammed this car but for some reason, the motor does not drive
when you issue the forward (w) or backward (s) commands from client.py. The car is recognizing the commands, as the
RGB LEDs fire up with each forward and backward command I send. However, the motor guns the rear wheels when you
flip the switch up on the motor hat so the motor definitely works; side question, what is that switch for? I am assuming
that needs to be turned on to get the car rolling, but it should not gun it like that; please correct me if I am wrong.

Any help with the motor functionality inside of client.py would be AMAZING! =)

Thank You!

EDIT:

Okay, after simply reading the text situated to the side of the 'switch' it is apparent that this is the 'on/off' switch for the Motor Hat.
I am assuming that turning the Motor Hat board on will activate the motor, that much is obvious; however, how does one go about
turning said Motor Hat board on without simultaneously instructing the motor to turn on @ 100% power..? I have checked the code
and am at a loss here, any help would be AMAZING!

Thank You!
Reply

Use magic Report

0

Threads

69

Posts

412

Credits

Website Editor

Rank: 8Rank: 8

Credits
412
Post time 2019-6-4 10:49:06 | Show all posts
If you're doubting that the motor doesn't work, you can power the motor with 5V independently. There's not any code of motor in client.py, all the car related code is in the folder server of Raspberry Pi.
Reply

Use magic Report

1

Threads

4

Posts

21

Credits

Newbie

Rank: 1

Credits
21
 Author| Post time 2019-6-4 20:00:24 | Show all posts
1557111628 replied at 2019-6-4 10:49 AM
If you're doubting that the motor doesn't work, you can power the motor with 5V independently. There ...

Hello there,
Perhaps I gave you too much information to begin a troubleshooting session. Here is what is happening,
as I have already made note that I am sure the motor is working.

- Mars Rover Pi is built and set up according to the instructions, which could use some revamping.
- Everything works minus the servo with the broken limiter included in the box and speech recognition (for another topic.)
- If you plug in or otherwise insert two 18650s into this Mars Rover everything boots up fine and the client connects without issue.

- IMPORTANT: If you issue forward (w) or backward (s) commands from the client.py interface the RGB LEDs fire up indicating command received, but the motor does not move.
- IMPORTANT: If you flip the Motor Hat switch to the on position the motor fires up @ 100% and the rear wheels spin and spin.
- IMPORTANT: When the Motor Hat board is "switched on," and the wheels are spinning like their life depends on it I CANNOT control it (Forward, Backward, Automatic Mode, etc.)
- IMPORTANT: I have reformatted the SD card multiple times and started from scratch over and over again while meticulously verifying every library and dependency is met.

Now that we know the client.py is sending the commands, the Raspberry Pi 3B+ is receiving them, and the motor definitely works... How does one go about turning the Motor Hat
on without the motor "gunning it" flat out?

Thank You
Reply

Use magic Report

1

Threads

4

Posts

21

Credits

Newbie

Rank: 1

Credits
21
 Author| Post time 2019-6-5 07:46:33 | Show all posts
Thank you for your help, all this talking to myself assisted me with finding the problem.
Reply

Use magic Report

1

Threads

4

Posts

21

Credits

Newbie

Rank: 1

Credits
21
 Author| Post time 2019-6-5 09:46:33 | Show all posts
Edited by 1559507739 at 2019-6-5 09:47 AM

Oh, and if anyone runs into the same issue which I outlined above; congratulations, you are as stupid as me! Haha. My power and motor cables were swapped, meaning I plugged them into the others slot on the Motor Hat. Also, after I fixed that I noticed the controls were all backward. I remembered seeing a reversed build somewhere, but couldn't find it.

So here's how to fix that, ssh into your Pi and navigate to the adeept directory created during initial setup. Navigate to the server directory and open the turn.py file with nano, vi, or whatever you would like. Find the following lines: def right and def left, then swap their values as shown here turn_right_max > turn_left_max, then do the same for the other, so both right and left are reversed then make sure to save the file. Next, open motor.py and find def motor_right and def motor_left, now look for "GPIO.output," then reverse the following below for both Dir_forward and Dir_backward on both motor_right and left!

GPIO.output(Motor_B_Pin1, GPIO.HIGH) >> GPIO.output(Motor_B_Pin1, GPIO.LOW)
GPIO.output(Motor_B_Pin2, GPIO.LOW) >> GPIO.output(Motor_B_Pin2, GPIO.HIGH)

Then reverse the following (e.g., if forward says 0, make it 1, etc.):

Dir_forward   =
Dir_backward =

Save the file and reboot or reload the server!

Now I just need to work on strengthing the front steering column for the servo, so it does not veer to the right every time I move forward...
Reply

Use magic Report

0

Threads

69

Posts

412

Credits

Website Editor

Rank: 8Rank: 8

Credits
412
Post time 2019-6-5 10:02:36 | Show all posts
1559507739 replied at 2019-6-4 08:00 PM
Hello there,
Perhaps I gave you too much information to begin a troubleshooting session. Here is w ...

1. check whether the servo interface is connected correctly.
2. Run motorTest.py anywhere of the raspberry pi.
3. Remember to use ‘sudo killall python3’ to shut down all the autostart car programs in the background before running motorTest.py.
4. Connect the motor to the driver board when start running motorTest.py. Can try to connect different motor interfaces (motor-A, motor-B).
5. After the program runs, the motor will rotate forward for 2 seconds, reverse for 2 seconds, and stop for 1 second, and then repeat the cycle.
Reply

Use magic Report

1

Threads

5

Posts

53

Credits

Registered member

Rank: 2

Credits
53
Post time 2019-6-10 10:17:14 | Show all posts
Hi 7739. I had the same problem about reversed command. This is a true  defect of the product and we all go  through the process of debugging the code. That's a pity. One day I will share my corrected version.
Sharing another experience: My robot fell off the table and broke. I glued the chassis, but the head motor broke. It is the servo motor that turns the head right and left and its gear supports completely the head. So I bought a Longrunner servo motor with metal gears and it's an improvement the head is more stable.
Reply

Use magic Report

2

Threads

6

Posts

36

Credits

Newbie

Rank: 1

Credits
36
Post time 2020-10-31 01:12:23 | Show all posts
Edited by 1571366253 at 2020-10-31 09:50 AM

I am having a similiar issue with my Mars Rover with No Forward and Reverse motion. I have verified that my "ONE" DC motor is connected to Motor A port. I have also tried it in the Motor B port; both ports do not yield any Forward or Reverse motion when controlling via the GUI. I do have the FRONT LED's change state/colors when proper commands are given. The "SINGLE" motor does operate when I connect 5v directly to motor's connections on the motor. All other steering or pan-n-tilt servo controls, video streaming, and high level functions control features but do not control the DC Motor. Any ideas? BTW, I am using a Raspberry Pi 3B+ and the Adeept Mars Rover Image.
I have also, swapped out the Raspberry Pi 3B+ with a Raspberry Pi 4B+ with 2gb ram and also build a new SD card following documents provided and have same results, All functions work except for DC Motor forward and reverse.
Reply

Use magic Report

23

Threads

223

Posts

814

Credits

Senior member

Rank: 4

Credits
814
Post time 2021-2-5 14:55:23 | Show all posts
1571366253 replied at 2020-10-31 01:12 AM
I am having a similiar issue with my Mars Rover with No Forward and Reverse motion. I have verified  ...

Please refer to the latest manuals and materials: https://www.adeept.com/learn/detail-33.html
If your problem is not resolved, please provide us with a detailed report (including product model, error report, pictures, etc.): support@adeept.com

Reply

Use magic Report

You have to log in before you can reply Login | Sign Up

Points Rules