My study project

Hello everybody.
I have a project to do with the uno unit-an object finding robot with ultrasonic sensor 2wd and 2 encoders,it should.find the object within 10 meters,get close to it and then return to the starting point where it started.
The idea.is by moving in square lines by.increasing after each turn for scaning,and then while found to move up to the object.
Any ideas for how the algorithem should look like? I have the ultrasonic and the encoders codes,but i wanna knkw how can i make the ultrasonic read simoultanously or more than enough for avoiding the misspoint problem?

10 metres is a big ask for regular ultrasound devices

We have ideas but let's show us yours :slight_smile: Start coding. Take baby steps. First get the thing to move, then to move how you want etc

PS I do hope you code better then you write. The compiler is not as forgiving as humans when it comes to random periods and commas, and missing spaces and capitals...

yes i'm not used to write in english but let's face what i've got right now in my project.
2 wheels connected to 2 12V motors via 298N, two encoders which i plan to put the 2,3 pins for interrupt,SR-04 sensor which i checked best range is up to 2 meters effective range and ofc i have the uno unit.
The robot already moves in square moves,i mean like snail but square ...And increasing every round,this way i plan to scan the object which should be within 10m from me.
My point is if i put the SR-04 steady on the front of the robot,i need the solution of fast reading during the move simultaneously and not reading on the end of each move ,any ideas how to make that in the code?

This project is for my studies,i could take laser sensor and find it faster but we had a limited budget,so..
any ideas?

10 metres is a big ask for regular ultrasound devices

bomardo:
yes i'm not used to write in english

Your English isn't the problem. But I don't know languages that don't let a sentence start with a capital and don't use spaces after a period or comma :wink:

bomardo:
The robot already moves in square moves,i mean like snail but square...

So you do have code! Bu that's top secret?

bomardo:
i need the solution of fast reading during the move simultaneously and not reading on the end of each move

But let me guess, that code uses delay() :wink: Then you'll need to rewrite that code to NOT use delay() :slight_smile: Then you have all the time to read the sensors while moving instead of putting your head into the sand an wait.

septillion:
Your English isn't the problem. But I don't know languages that don't let a sentence start with a capital and don't use spaces after a period or comma :wink:
So you do have code! Bu that's top secret?
But let me guess, that code uses delay() :wink: Then you'll need to rewrite that code to NOT use delay() :slight_smile: Then you have all the time to read the sensors while moving instead of putting your head into the sand an wait.

Believe me there are languages without capital letters in the start of the sentence.
BTW i've tried not to put the delays and this thing works just find,I still don't have all the code,just the encoders,ultrasonic and the motor functions which I use all the time.
I have 3 options of moving:
1.Straight line.
2.90 Degree turns(or 360 *4)
3.Back line
By the idea of the encoders I can calculate where I'm all the time during the whole process.
I've just tried the "just straight" line towads the object after found and it works just fine till it gets 25 cm from it,then delay 10 seconds and then go backwards w/o the need to scan anymore... this is the pre final step and it's done only once in the whole program so i allowed it to be.
Thanks for the idea removing the delays!

AWOL:
10 metres is a big ask for regular ultrasound devices

Makes the search part more important then?

bomardo:
yes i'm not used to write in english but let's face what i've got right now in my project.
2 wheels connected to 2 12V motors via 298N, two encoders which i plan to put the 2,3 pins for interrupt,SR-04 sensor which i checked best range is up to 2 meters effective range and ofc i have the uno unit.
The robot already moves in square moves,i mean like snail but square ...And increasing every round,this way i plan to scan the object which should be within 10m from me.
My point is if i put the SR-04 steady on the front of the robot,i need the solution of fast reading during the move simultaneously and not reading on the end of each move ,any ideas how to make that in the code?

This project is for my studies,i could take laser sensor and find it faster but we had a limited budget,so..
any ideas?

Funny, 5mW red laser modules are bag of 10 for about $4 shipped but that doesn't include phototransistor or IR detector.

Will the wheels never slip? Then the encoders will be right.

This is your school project, we can suggest but that's it. I suggest that you look into the Many Things At Once sticky thread at the top of the forum section. It will get you going.

Start point.
Use encoders with dead reckoning to move around a modest size grid of 'boxes'.
Return home occasionally to re-calibrate you origin -
then move off to plot a new direction / range of boxes in another area.
Repeat.
One of those journeys should hopefully take you within range of a sensor ping.
Ignore all the other 'empty' boxes...
Then you need recurse in that plot area to localise the target
Return to base and report as needed.

This of course requires good traction, and accurate wheel feedback / compass logging.
Otherwise - anything you do has to be line-of-sight with a suitable sensor.

what is HOME ? is that a reference to can return to once in awhile ?

it that something you can detect ?

as a comment drive wheels may slip, but an idler might be a way to measure distance.

is a compass part of your package ?
any sort of direction ?

No compass,No laser sensor.
ATM I need the help with the reading of the HRC-04 which has some "noise" scans which affect my program.
My ultrasonic stand horizontaly 25 cm from the floor horizon.
When I scan an object more than 150 CM (time i need to do A) ,sometimes it has a noise scan that shows me less than 50.... how can i filter those noises?

p.s
I almost done with the program till the arrival to the object,the only thing i miss is a clear ultrasonic readings without those jumps.

How soon after 1 ping and read is the next? Long enough to travel 8 or 10 meters?

Also be aware that air temperature is the biggest change factor in the speed of sound in still air. It is slower in the cold, faster in the hot. It begins to be noticeable to me below freezing, about 50F below standard, I don’t go out at 50F above so I haven’t experienced my footfall sounds arriving a bit ‘too fast’ as ‘frozen step’ sounds do come late.

Over 1 meter take a reading in the heat of day and then a reading in the cool of night.

bomardo:
When I scan an object more than 150 CM (time i need to do A) ,sometimes it has a noise scan that shows me less than 50.... how can i filter those noises?

The answer to that question is embedded in the question. There is no technological or mathematical answer. There are a plethora of ways of filtering it - the results will never satisfy both requirements of accurate positive results and a lack of false positives. A trivial example - you can just ignore everything less than 50 - but then you fail to detect a true reading under 50. Averaging will slow it down... So it goes with every solution. Every solution will have a flaw because you are handed imperfect data to begin with.

Ping is a cone, you can get multiple returns for one ping. What happens if you send another ping right after the first reflection arrives? What do you read then? Wait long enough for at least a 10m return before sending the next ping out.

In close to 25C air sound goes 340 m/s. In Arduino terms that's 340 mm/milli, 34mm/100 micros. With return, 100 micros is 17mm.

Arduino micros is rounded up to the next 4, to time the return closer you use a loop or series of counter increments and compares to measure less than microsecond intervals. There's a lot on that including code in The Arduino Playground, IIRC.