Hobby Components Maze Runner (HCROBO0052)

Hobby Component self build kits
DaveA
Posts: 8
Joined: Mon Apr 24, 2017 6:56 pm

Re: Hobby Components Maze Runner (HCROBO0052)

Post by DaveA » Mon Feb 22, 2021 11:36 pm

Thanks for that. I just wanted to clarify this before moving on to the problem I am having.

Initially, the robot was working correctly, as it always has. I have no reason to think I’ve damaged it in any of this.

I installed the library and uploaded the Line-Follow sketch from the library examples (as Nano, old bootloader) but this didn’t operate correctly. It did not perform the rotating sensor calibration routine and it behaved erratically. On separate resets, it would occasionally follow a line, but mostly it ignored the line or did partial turns and took off in random directions.

I gave up on this for now and uploaded the original Maze Solver sketch but now this didn’t work!

Again, it did not perform the rotating sensor calibration routine. I think this is significant. It made all the familiar beeps but it didn’t go anywhere. As the serial adaptor was connected, I brought up its “telemetry” on the serial monitor. What this showed was:

• Results for the line sensor calibration, which changed on different surfaces, but there had been no motor movement
• It then said that the maze was finished even though it hadn’t budged.
• It then counted down to the “solve” stage and immediately said it was finished.

Things I have tried include:

• I don’t have any of the L9110H chips to swop but I wrote a small sketch which just performed a few simple wheel motor movements and it worked fine.
• I have swopped out the ULN2803 chip – no change
• I’ve tried another ATMega328P-PU chip, set up as a Nano, old bootloader, with the sketch uploaded both through the serial interface and externally – no change.
• I have checked my boards minutely and I can see no visible problems.

I hesitate to suggest this but this would be consistent with a software problem relating to the calibration routine. Is the current library download package definitely OK? (No offense).

I haven’t got much hair left to tear out so any suggestions welcome!

Cheers
Dave

andrew
Site Admin
Posts: 1119
Joined: Sun Aug 05, 2012 4:15 pm

Re: Hobby Components Maze Runner (HCROBO0052)

Post by andrew » Tue Feb 23, 2021 9:04 am

I hesitate to suggest this but this would be consistent with a software problem relating to the calibration routine. Is the current library download package definitely OK? (No offense).
Well it would be unlikely but I don't want to rule it out. If you can bear with me I'll get one set up and see if we still have a test maze. Once I've checked the library we can then take if from there.

Just to be absolutely sure it defiantly was working fine before you uploaded a new sketch?
Comments made by this poster do not necessarily reflect the views of Hobby Components Ltd.

DaveA
Posts: 8
Joined: Mon Apr 24, 2017 6:56 pm

Re: Hobby Components Maze Runner (HCROBO0052)

Post by DaveA » Tue Feb 23, 2021 11:18 am

I haven't used the robot much in recent times but it had a new battery and yes it was working normally.

I have attached a copy of the telemetry from the solver sketch. The robot was on the line and you will see it recognises this on the middle sensor but it didn't move.

I can't seem to attach a sketch. I was going to send the one which tested the wheel movement but, again, the calibration check didn't work.

Cheers
You do not have the required permissions to view the files attached to this post.

andrew
Site Admin
Posts: 1119
Joined: Sun Aug 05, 2012 4:15 pm

Re: Hobby Components Maze Runner (HCROBO0052)

Post by andrew » Tue Feb 23, 2021 5:16 pm

I've checked the library on the forum and can confirm it's the right version so that's not the issue. I'll take a look at the file you've attached but just to make sure it's not a bad IR sensor causing the issue I've attached a very crude sketch that will test the sensors. If you can upload it to your MR and open a monitor window at 9600 baud it should display raw sensor readings from the 5 IR sensors. If you run your fingers over them the values should change from roughly 200 to 1000.

Can you give this a test and let me know if they are doing something sensible?
Maze_Runner_Sensor_Test.ino
You do not have the required permissions to view the files attached to this post.
Comments made by this poster do not necessarily reflect the views of Hobby Components Ltd.

DaveA
Posts: 8
Joined: Mon Apr 24, 2017 6:56 pm

Re: Hobby Components Maze Runner (HCROBO0052)

Post by DaveA » Tue Feb 23, 2021 11:06 pm

Thanks for that. I appreciate the trouble you are going to. I've run the sketch and it shows the sensors to be responsive but there are differences between them:

Using your finger test (sensors 0 to 4): 122/680, 119/640, 123/820, 126/1002, 210/1003

Standing on white paper: 850, 810, 1011, 1015, 1012

Standing on black surface: 205, 190, 230, 260, 250

Rotating over a 20mm black tape on white paper (aligning each sensor in turn with the line):

850, 810, 1011, 1015, 250
860, 800, 1007, 280, 1012
850, 700, 317, 1012, 1012
850, 200, 1004, 1014, 1012
210, 790, 1010, 1014, 1011

All +/- about 10 units

Also I discovered some interesting behaviour with the Maze solving sketch:

As I said, if is just standing on the line when started it does not move even though it reports sensor calibration etc to the serial monitor.
However, if you start it and move your finger over the sensors it produces jerky movements in the wheels. If you then put it on the line it starts to attempt to do the maze in a very haphazard, jerky and drunken sort of way. Presumably because it isn't calibrated but at least it moves.

Cheers

andrew
Site Admin
Posts: 1119
Joined: Sun Aug 05, 2012 4:15 pm

Re: Hobby Components Maze Runner (HCROBO0052)

Post by andrew » Wed Feb 24, 2021 10:12 am

Thanks for checking. The values from the test sketch all look sensible. I was hoping it would show a bad sensor as this would explain exactly what your seeing.

The way that line sensing works is that IR light bounces off the surface and hits the appropriate IR receiver which is basically an IR opto-transistor. This sensor then charges up a capacitor. The more IR hitting the sensor the faster the capacitor charges up. Each sensor capacitor is also connected to a digital input pin on the microcontroller which then times how long it takes for the voltage on the capacitor to flip the digital input from a logic 0 to a logic 1.

The problem is if there's not enough IR light hitting the sensors to flip the digital input, for example due to a faulty sensor, it will just freeze up and do nothing like you're seeing.

The other thing to point out is that if it does get though the calibration process but doesn't do a proper calibration for some reason, maybe again a bad sensor, then it will just behave erratically, again like you're seeing.

One thing I do notice from your results from the maze solving sketch is that your upper calibration values look quite low. I'd expect values round the 30's to 40's for most of the sensors in a well lit room. What are you using to test it on? Ideally it should be a white surface with something like black electrical tape.

BTW forgot to mention in my last post, I've fixed the issue with not being able to attach an .ino file to posts.
Comments made by this poster do not necessarily reflect the views of Hobby Components Ltd.

DaveA
Posts: 8
Joined: Mon Apr 24, 2017 6:56 pm

Re: Hobby Components Maze Runner (HCROBO0052)

Post by DaveA » Wed Feb 24, 2021 11:47 pm

Yes I was hoping the lower numbers on 2 of the sensors were significant as I have spare sensors.

Thank you for the detailed explanation of its workings, very informative.

Regarding the test surface, my original "T" test maze was 20mm black tape on light cardboard which previously worked fine so it was fairly forgiving. I'm now using the same tape on white paper. I didn't know how important extraneous light is so it's been tried in daylight, artificial light and even in the dark.

Taking up your last 2 paragraphs regarding the calibration, can I just make sure I have been completely clear on what happens when the HCMRunner.CalibrateLineSensors() is called. The robot doesn't rotate in both directions as it should, it doesn't move at all, even though it returns sensor calibration results to the serial monitor. This is why it shows a higher value for the middle sensor because it has been over the line the whole time. The sensors have had no opportunity to be calibrated.

I started the robot over a white and then a black surface and captured the results from the serial monitor in the attached text file. They seem reasonably sensible.

I have also attached the simple sketch which demonstrated that the motors are working when using other commands.

Puzzling!!

Cheers
You do not have the required permissions to view the files attached to this post.

andrew
Site Admin
Posts: 1119
Joined: Sun Aug 05, 2012 4:15 pm

Re: Hobby Components Maze Runner (HCROBO0052)

Post by andrew » Thu Feb 25, 2021 4:49 pm

Regarding the test surface, my original "T" test maze was 20mm black tape on light cardboard which previously worked fine so it was fairly forgiving. I'm now using the same tape on white paper. I didn't know how important extraneous light is so it's been tried in daylight, artificial light and even in the dark.
That sounds fine. Ambient light isn't that important but it will affect the max an min levels a little which is why I mentioned it. The only thing that will mess it up is if direct sunlight is shining on it. That will just swamp then sensors out with infrared light. But that's obviously not the issue here.

Taking up your last 2 paragraphs regarding the calibration, can I just make sure I have been completely clear on what happens when the HCMRunner.CalibrateLineSensors() is called. The robot doesn't rotate in both directions as it should, it doesn't move at all, even though it returns sensor calibration results to the serial monitor.
Yeah that's odd. We've pretty much ruled out the sensors and the motors so I'll take a look at the library to see if I think of anything that may cause it to not move yet continue past the calibration process.

Please bear with me though, we've not sold them for a while and the library was written back in 2016 so I'm a little rusty as to the details of how it works. I'll need to go though it line by line to refresh my memory.
Comments made by this poster do not necessarily reflect the views of Hobby Components Ltd.

andrew
Site Admin
Posts: 1119
Joined: Sun Aug 05, 2012 4:15 pm

Re: Hobby Components Maze Runner (HCROBO0052)

Post by andrew » Fri Feb 26, 2021 3:34 pm

I've been staring at the library and in particular the calibration routine but at the moment I can't see any condition that would cause it to not rotate the motors and yet still get to the end of the calibration routine.

Can I check with you - does it immediately output the calibration results right after resetting the MR or does it take few seconds like it is actually performing the calibration process but it's just that the motors aren't running?

What I'm trying to figure out is if it's stepping through the calibration process so fast that the motors don't even have chance to move or, it is stepping though it at the normal speed and it's just that the for some reason it's not turning on the motors.
Comments made by this poster do not necessarily reflect the views of Hobby Components Ltd.

DaveA
Posts: 8
Joined: Mon Apr 24, 2017 6:56 pm

Re: Hobby Components Maze Runner (HCROBO0052)

Post by DaveA » Sat Feb 27, 2021 12:18 am

I've timed the program (with a hand stopwatch!) and found that it takes 2 secs to get to the "turn tune" line, immediately before the calibration routine and then a further 5 secs before the calibration results appear on the serial monitor, followed immediately by the "EXPLORING THE MAZE" banner and "FOUND THE FINISH LINE !" The robot doesn't move at all in this time. The whole run takes ~22 secs including the 10 second count down to the "solved" run.

I think you are right. It is allowing the time for the calibration, it just isn't turning on the motors. This fits with with a similar test to one I tried before, that if I lift the robot a little way and rotate it manually over a line during this calibration time, to try and emulate the motor motion, it does then come to life and try to follow the line. Not very well, obviously, because I can't turn it accurately but I think it proves a point. The problem seems to be down to the motors not turning on for whatever reason for the calibration.

I have found some strange behaviour writing some test sketches controlling the motors. The example I sent did work as intended but others have not worked as expected. My programming abilities are are fairly basic but I'll look at this further.

Cheers

Post Reply