Zero readings from line follower and ultrasonic sensors in scratch


#1

Continuing the discussion from Jittery Ultrasonic Sensor Output:

We ran into a similar problem while running interactively in scratch. Both the line follower and the ultrasonic sensors would regularly report zeros when they were clearly seeing other readings. The line follower was indicating that it saw reflections with one or more of the sensors as indicated by the lights yet the sensor would report zeros interactively. Diagnostic routines to simply pole and print the sensor readings would almost always report zeros. If we downloaded related programs to the arduino and ran them locally, they worked fine (obviously we could not print). This was especially frustrating because we had a group of 28 kids trying to program mbots and run them interactively in mBlock. The programs only ran when downloaded to the arduinos otherwise they were fickle. This occurred with macs and pcs, with bluetooth and 2.4G communication. In the end, the kids still had fun, but we were not able to tackle more difficult programs given the issues we were having. We would love to continue using the mbots for the kids at our school, but need to get past this issue.

Kind Regards


#2

Also, at least four mbots showed this behavior - hope this information helps.


#3

Hi Sadams69, you just mentioned that you were using Scratch, not mBlock. I need to make it clear so that I could transfer this issue to our engineer.

Besides, we develop a new iPad app named mBlockly for mBot, still have some problems on class education because of bluetooth paring issues, but we have tried to solve it and publish a new version. You could try it :slight_smile:

The mBlockly Download link


#4

Yes, I have used many makeblock ultrasonic sensors with orion boards and mbots and you are totally correct- some of them produce spurious zero values- after testing over 50 makeblock sensors I realised that its not a one off.

It is so prevalent that when I train teachers how to use mbots and orion I advise that they use a software filter to ignore any zero values- so for example the if statement might be if value less than 20 and greater than zero etc rather than just if value less than 20.

As I teach robotics I am not that bothered as this is just another problem for the students to sort out- which is why robotics is so great.


#5

Sorry for being imprecise. We used the latest version of mBlock for both the mac and the PC. I’d pull up the version in about but it pulls up a webpage and says “404 Not Found; nginx/1.4.6 (Ubuntu)”. Hope this helps.

We would love to try other ways of interfacing with the mbots. I’ll take a look at the ipad version over the holidays. Thanks.


#6

Thanks for the tip. We were able to use something like that running remotely. Zeros were infrequent, but still occurred. The filter helped a lot. In interactive mode, actual readings were infrequent enough to render them useless. Also, the line follower sensor should report zeros sometimes so it is hard to filter them appropriately.

I appreciate your help.


#7

You might also be seeing zeroes caused by the serial delay with radio transmissions. It’s an unavoidable problem, so using a filter is generally the best answer.


#8

I am seeing a problem even outside of scratch with sensor output returning to zero.

I have been running an Orion board with the Ultrasonic sensor output tied to the 7-segment LED.

While running an object avoidance program, I would see the LED output go to zero momentarily.

The program initiates a turn cycle when the UltraSonic-Distance is under 20

It seemed to occur after coming out of a wait cycle during a turn, and would trigger another turn cycle which is at the top of the loop.


#9