Ultrasound module problem


#5

Hello,
Thanks for the reply.
I used your code and I also tried the following

In both cases I got the same problem which is reproducible.
(1) I press the green flag and run the scripts and it works fine
(2) I move the mbot back to the starting position to run them again
(3) I press the green flag to run them again and it stops immediately because the distance it measures is less than 10 (9.5 to 9.86 cm)
(4) I press the green flag and it runs fine

SO it seems that for some reason after it stops the mcore keeps the last value the sensor measured and it returns it the next time I try to get the distance.

I do not use the USB cable. I use the 2.4 GHz connection to control the mbot.

Do you have any problems with the mbot driving on a straight line. It does not move on a straight line even when I hold it on the air so it does not touch the floor, so it must be a problem with the motors or the gearboxes. One of the two motors seems to run slower than the other.

And a last question. Do you know where I can find documentation for the mbot extention blocks? Online or in pdf form.

Thanks again,

Napoleon Maou


#6

Napoleon,

I have had no success resolving the problem in #3 above. I have tried a number of things with inconsistent results.

I have made some progress with the motors though. If you increase the speed setting to 75 or 100, it seems to work better. A speed setting of 50 just does not seem to provide enough power to work as expected.

I hope this helps some.

Mike


#7

My finding is that the motors need to have a power of at least 70 to move forward. Going backwards takes a bit more.

On a side note, what type of batteries are you using? I’m using a 3.7V 2500 maH LiPo, but I’m wondering if the extra weight of the batteries might be playing into the motors being able to get the robot moving.


#8

The input voltage has a LOT to do with the value that will cause the motors to start. At some point the internal resistance will matter but that is more for high stall situations. The power level in the programming is really just a setting for the speed control to use for how much not to reduce the output voltage. Unless there is a step-up voltage circuit in there the most you will get to the motor is the input voltage of the battery. Then as you reduce the power it starts to lower the effective voltage (not really exactly but it uses a PWM to chop up the voltage and the motor sort of sees that as a lower voltage)
So if you start with 6v your bot will go faster than at 3.7v with all other things equal.


#9

Hi Napoleon,

I don’t know what’s going on with your motors but I think I might know what’s the problem with the distance sensor.

I tried the two bits of code shown in the image.

With the first, no success.
I tried to change the port number, to disconnect and connect again the 2.4G and no success, Panda kept saying NULL.

Then I thought it might be the 2 seconds that confused Panda.
I tried the second bit of code shown in the image and it worked!
It could be that Panda gets info from the sensor at a high rate and when he’s got to wait 2 seconds he panics, doesn’t know what to do and goes NULL? Just speculating…

Also, if your ultrasonic sensor is connected to Port3, make sure you have Port3 selected in the scroll-down menu on your sensor block.

Hope this helps!


#10

I’m sort of wondering because I set up my mBot with the 6v battery pack and I’m not seeing significantly different performance with regard to the power. It starts moving very slowly at 50, but not much under that. At a power level of 70, it moves at the same speed as with the 3.7v LiPo. I agree that the input voltage causes the motors to start at a lower power level, but I’ll need to do additional testing to determine whether or not the robot actually goes faster at the same power level setting. It appears to travel the same distance so far, so I’ll post my results when I get a chance to tally them up. Wouldn’t there normally be a step-down circuit to keep the voltage at 5v DC or under since most Arduino-based stuff is aimed at either 3.3VDC or 5VDC?


#11

according to this:
http://wiki.makeblock.cc/index.php?title=Me-Motor_Driver
The DC motor driver will run from 6-12v so I’m not sure how you are getting them to run at all with 3.7v.
I’m guessing you are actually using a 2 or 3 cell LiPo which would be giving 7.4v or 11.1v respectively.


#12

I am magical? :laughing:

The spec sheet on the battery says it pushes 4.2vdc when fully charged. I bought it from Adafruit at this link. Adafruit doesn’t specify whether or not it is a multi-cell battery, and the spec sheet doesn’t mention it either. The major attraction was the price. It would be really helpful if our friends at Makeblock would list a battery specification and / or sourcing for said same. :slight_smile:


#13

it is a single cell. I’d suspect you might have odd issues running the makeblock boards with only that much voltage. Obviously you have something working but there are probably some situations where a motor load or something else that will cause a drop in voltage that the processor or supporting part will cease to work.
Nothing damaging but potentially frustrating.


#14

So here’s the weird part. As I’ve been writing the apps for my class, I have not had any issues out of the 3.7v LiPo. Since the board is custom, I’m wondering if there is a voltage amplifier circuit somewhere that is stepping up the power for the motors or if there is another explanation. :-/

Just another fun day in the asylum! :smiley:


#15

Which board are you using?


#16

The mCore board that comes with the mBot.


#17

Good News!
Here is the answer from makeblock in another forum post:


So it looks like the mCore can handle lower voltage than the Orion. I suspect that has a lot to do with the lack of red DC voltage out ports.


#18

You mean I’m not magical? :disappointed:

Seriously though, I had suspected that might be the case. . :slight_smile:


#19

hello I’m sorry not good my english.
I have a mbot and I want a project for student but ı dont work ultrasonic sensor.I try all of your writing .Not work.I explorer google .And so not working.Mbot not see distance anything.I hope I tell my problem .Please help me.


#20

#include <Makeblock.h>
#include <Arduino.h>
#include <SoftwareSerial.h>
#include <Wire.h>

MeUltrasonicSensor UltraSensor(PORT_6);
void setup()

{
  Serial.begin(9600);
}

void loop()
{
  Serial.print("Distance: ");
  Serial.print(ultraSensor.distanceCm());
  Serial.println("cm");
  Serial.print(ultraSensor.distanceInch());
  Serial.println("inch");
  delay(100);
}


#21

Hello
firstly thank you for your answer.

I try this code arduino 1.6.5 but not work again.

Is my ultrasensor broken ? But I buy new a mount before.I have to make a project students but ı cant.My student want to make a project a lot.

What kind of projects proposal for me?


#22

I posted this because the code provided by Makeblock doesn’t compile.I wish Makeblock would make sure that the code, version, and examples work, especially since the Makeblock products are designed for mostly school kids trying to learn basic coding.

If you sell a product like this then you should make sure it works, and with what hardware, operating system it was successfully tested on. I don’t think this is too much to ask!


#23

@eesmed,

Try this instead. I copied some code from Makeblocks UltrasonicSensorTest.uno and modified it with some code from mBlock.

#include <MeMCore.h> //This is from mBlock
MeUltrasonicSensor ultraSensor(PORT_3); //mBot port
void setup()
{
  Serial.begin(9600);
}
void loop()
{
  Serial.print("Distance : ");
  Serial.print(ultraSensor.distanceCm());
  Serial.println(" cm");
  delay(100);
}

This should run on the mBot with the Ultrasonic on port _3. I tested on Win10 with Arduino 1.6.7. The board is set to Arduino/Genuino Uno. Launch the serial monitor to see results.

I hope this helps,

Mike


#24