Pirate 4WD Mobile Robot Kit for Arduino with Bluetooth

userHead AndrweGoodwin 2022-05-09 16:34:39 668 Views15 Replies

Hi,

 

I bought the “Pirate: 4WD Mobile Robot Kit for Arduino with Bluetooth 4.0” for my son, for Christmas.  We've been building it (after some delay) and it is physically “there” now.  The instructions were pretty straight forward to this point.

 

The programming side though is a little beyond us at the moment.  We have downloaded the arduino software and can successfully connect to the romeo board.  We can't verify the initial test code though. It says the motortest.ino file/directory can't be found.   From some basic research I'm thinking I'm missing a library in the software?  I've tried searching for sen0001, URM37 and other codes from the dfrobot website without joy in the manage libraries section.  Am I on the right path here?  Should I be looking at another website to download a zip of the correct libraries?

 
I can't find any instructions with this kit that deals with the programming, outside of the instruction to upload specific bits of code.  This is all on the tutorial pages www.dfrobot.com/product-116.html


Is anyone able to save us please?

thank you.

2022-05-15 15:21:10

BTW, the DC motor with capacitor is like this.

 

userHeadPic R2D2C3PO
2022-05-13 03:32:36

Hi,

Thank you again for the help.

 

I think I have the issue noted at the bottom of the ROB0022 page in the FAQ:

Q: The servo twitched rapidly and the ultrasonic sensor produced inaccurate readings while the motors were running, how to solve this problem?

A: You can add a 0.1uF capacitor between each motor's positive and negative pole.

 

If the program runs wihtout the motors engaged then I get what I think is correct: 

carAdvance33carAdvance19

 

As soon as the motors are engaged though, the sensor stops and produces zeros.

carBackcarTurnRight0carBackcarTurnRight0carBackcarTurnRight0carBackcarTurnRight0 

 

Do you sell the 0.1uF capacitors?

Do you have a rough diagram as to where I would need to solder them as well please?

 

thanks

userHeadPic AndrweGoodwin
R2D2C3PO wrote:

I have two solutions to this problem.

 

1) Provide independent power to MCU and sensor, such as another set 5V power bank or battery. It will isolated the power surge. 

2) It could be a little tricky,  you need to write some code.  As the sensor is not always providing reliable readings,  I mean not 100%.  So we need to do some algorithm to avoid such problems.   So, the magic is called “Average algorithm”.  The principle is quite simple.  Average the latest 3-5 readings.  

2022-05-15 15:15:57
AndrweGoodwin wrote:

Thank you.

Ok so I can just use a second battery set (like FIT0266)?

Connect that to the sensor (black/red) and we should be good?I will give it a go

Thanks :)

2022-05-16 00:51:30
AndrweGoodwin wrote:

I managed to setup temporary separate battery pack feeding the sensor only but I still have a similar issue.

The sensor reads properly itself, but when the motors are engaged then it reads zeroes.

Does this mean I have interference on the green/blue connected to ports 10 & 3 somehow?

 

 

2022-05-16 02:18:17
3 Replies
2022-05-12 13:32:45

So.. the logic must be that the robot is going backwards because the code or it, think there is something in front and to the left/right of it.  I know the sensor is good and the motor is good.

userHeadPic AndrweGoodwin
R2D2C3PO wrote:

You are very close to it.  Now, work out the control logic, such as when the robot should move forward and backward, what to do with the sensor, etc. 

2022-05-12 19:33:21
1 Replies
2022-05-12 04:22:27

R2D2C3PO, thank you !

I found the sensor was mis-wired.  We have both the motor test working (forward, back, left, right).

amnd

the sensor working.  It scans left and right in the test and serial output shows numbers from 34 (with nothing in front), to around 3 when something is right in front.

This is great :)

 

The next issue is that the actual drive program doesn't work for us.  The robot almost immediately moves backwards and then starts a funny left right back movement.  I will go over everything again.

 

userHeadPic AndrweGoodwin
2022-05-10 16:18:33

Sorry this is becoming a scratch pad..

We had a moment of realisation that each bit of code overwrites the last bit… so the motortest actually does work.

The right turn seems to be quite poor (left is good), so we will take it apart again to make sure there are no faults with the motors/connectors on that side.

 

We also get some movement when specifically testing the sensor too.  It looks to scan as expected, although i don't have any serial to test the distance output (I get the impression that would be what you can do from the website).

 

The final code, when uploaded, though doesn't work.  The robot moves backwards for a bit and doesn't use the sensor at all.I'm assuming that code should be the final piece but without the Bluetooth bit?  It shoudl move around when turned off, avoiding obstacles.The romeo website has plenty of code so I think we need to understand that more.

 

thanks

 

If anyone has a pre-built code to do eveyrthing then please let me know.  Whilst it is a bit of a cheat, I think we're out of our depth!

 

userHeadPic AndrweGoodwin
R2D2C3PO wrote:

It is like code puzzle.  Every piece works fine, while quite difficult to put them together.  

 

Here is a shortcut to this,  please try the sample code,  make sure the pin mapping are correct, you should be able to make it work.  

 

https://wiki.dfrobot.com/Basic_Kit_for_Cherokey_4WD_SKU_ROB0117

2022-05-11 11:24:11
1 Replies
2022-05-09 21:14:30

 Try: https://wiki.dfrobot.com/4WD_Mobile_Platform_SKU_ROB0022

 

You don't need extra library to use motor, Romeo BLE and Servo.    

 

You can also find some info about romeo here https://wiki.dfrobot.com/RoMeo_BLE__SKU_DFR0305_

userHeadPic R2D2C3PO
AndrweGoodwin wrote:

Hi,

Thank you.  That link really does help.

I've changed the wiring slightly to match that and it now turns on and moves a bit.  Certainly progress!

The sensor doesn't seem to do much though.  It moved a bit but we're clearly still missing something.

The Bluetooth side seems difficult too, we will persevere though.

thanks

2022-05-10 03:19:07
1 Replies
2022-05-09 21:00:46

ok.. apologies again.

It looks like the site in China has differences in the build/coding for this.

Had a big smile earlier as the sensor moved by itself (for the first time ever). :D

 

wiki.dfrobot.com.cn/_SKU_ROB0022_%E6%B5%B7%E7%9B%97%E8%88%B9%E5%9F%BA%E7%A1%80%E5%A5%97%E4%BB%B6

userHeadPic AndrweGoodwin
2022-05-09 19:06:10

Sorry can't seem to find a way to edit my original post.

 

I've tested using something like “#include <ArduinoRobot.h>” and it finds them ok.  Are the instructions on the website old/incorrect?

Is there a similar guide to the physical build part, that relates to the programming please?

 

Do I need libraries or something like that for these?

Romeo BLE (SKU: DFR0305)DF05BB Standard Servo 5Kg (SER0020)URM37 V4.0 Ultrasonic Sensor For Arduino / Raspberry Pi  (SEN0001)

 

We're more than happy to learn, just a bit lost as to where to start, sorry.

 

thanks

userHeadPic AndrweGoodwin