Ultrasensor not working as expected


#1

Hi guys,

I created a simple program using the say command returning ultrasensor reading, and Im always getting a random values lower that 1. For example 0.358, the next time I could get 0.865, so on and so forth.

I read that the measures should be between 3 and 400, so how can I get that low value and random?

Thanks in advance

Regards


#2

Well, as near as I can tell, Scratch code in mBlock 3.4.11 does not communicate with the Ultrasonic sensor. I haven’t tested the rest of the sensors, but I can confirm that the Ultrasonic sensor just sits there and the ‘say’ command shows zero.

I wrote an Arduino sketch to confirm that the sensor was working and verified that it was indeed working correctly (see sketch below):

#include <MeAuriga.h>

MeUltrasonicSensor us(10);

void setup() {
  Serial.begin(9600);
}

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

@tech_support may be able to provide some better insight. :frowning:


#3

It should be 3-400 cm. Please make sure you did upgrade firmware, then try some other ports, if it is still the same result, the ultrasonic sensor should be faulty.


#4

Hi @tech_support, for what it’s worth, I tried all of the available ports on the Ranger and although the ultrasonic sensor worked fine with the Arduino sketch, it never seemed to work from mBlock 3.4.11. Not sure what the issue is.


#5

That is strange. If it works with Arduino, that means nothing wrong with the hardware devices, the main board, the ultrasonic sensor, the port and wire.
Kindly to check that, before trying to get distance from panda with mBlock 3, have you tried to upgrade firmware? What is the result you always got? Using same board, same module?
How about mBlock 5? Is it convenient to have a test?


#6

I did my usual clearing routine (upgrade firmware, reset default program), then ran the program. The panda only reported 0 as the value. I haven’t tried mBlock 5 yet. Same board, tried all the available ports.


#7

I confirm that the various sensors DO NOT RESPOND correctly in Scratch mode with the Auriga. I can also get some of them to work with Arduino but the way the stock firmware of the Auriga is written makes all kinds of instabilities happen. In short, I have found that the developer of the firmware and the interpretations of the blocks in mBlock use too many interrupts and all things get very complicated in matter of seconds.
You can find my resend posts on this forum regarding the strange behavior of the various sensors, especially when using encoder commands.


#8

Hi Michael,
We did test it again and again, but never found same phenomenon. I am also confused.
In your side, the issue always happens to a specific ultrasonic module? Or randomly?
And have you tried to clear cacha in mBlock 3 before testing again?
Please also try mBlock 5 to have a look.
Please kindly tell us if you have any findings.


#9

Yes, I remember last encoder issue and I checked with my colleague Eleven.
Interrupts is necessary to get it work, but this may get be incompatible with some extensions.
“various sensors”, please give us more details, we will check it.


#10

I have tried Me Line Array, Me RGB Line Follower, Ultrasonic and simple Line sensor and all have issues when using more than 1 sensor or sensor + motor combination. Just to prove me wrong, can you upload a video with simple Line Following + Obstacle Avoidance working together with Ranger/Auriga?


#11

If there is no Me Line Array plugged in, still have issue with Auriga board? Would you please show us how did it influence other modules? Our test shows only influenced when using with Me Line Array.


#12

Would you just please show me a working example of a Line Sensor + Ultrasonic Sensor + motors being used together (i.e. Line Following and Avoiding an Obstacle). Maybe I am a bad programmer or I don’t know how to use the products correctly.

Regarding the Me Line Array, please don’t use the excuse that the extension is not official Makeblock. You offer the product, you should offer the extension as well. Or you could just say it doesn’t work for the Auriga.

I am anxiously awaiting to see a working combination. I will not be offended if it turns out that I am just a bad programmer, It would solve a million problems for me.


#13

I want to note that I haven’t spent a lot of time with mBlock5 because it is in a beta state, but I did this program from mBlock5:

I have yet to figure out how to run a program that allows me to use the say block to display readings from the robot so I tried to turn the motors on / off with an if statement. This program worked but I would be interested to know how to display the values with the sprite.


#14

Hi Chuck. My above reply was towards techsupport, not you. I am still waiting for a post or a reply from techsupport / Makeblock with mBlock code and video showing the working combination of the encoder motors and Ultrasonic sensor and Line sensor. I am one of Makeblock’s biggest fans, but this issue has confused me and has had me spend more than a month now trying to solve it in time before the new school year starts.


#15

Hi @Giannos,

No worries, I was responding to @tech_support’s request to try Makeblock5. :smiley:

Regards,

Chuck


#16

It will show the result.


#17

Would you just please show me a working example of a Line Sensor + Ultrasonic Sensor + motors being used together (i.e. Line Following and Avoiding an Obstacle).


#18

Ah, so the say block is no longer needed to display variables from the Panda?

(熊猫 Rock!)


#19

Yes, any variable will be listed on the stage.


#20

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.