mmmries

mmmries

Using TMF8821 time-of-flight sensor for navigation

This is part of the toy_robot group. Some of us are playing around with using Nerves to control small robots and specifically this thread will be about trying to use the TMF8821 sensor to detect objects in front of our robot for the purposes of navigation.

I’m planning to build on the excellent work of Powell Kinney who implemented GitHub - pkinney/tmf882x · GitHub

Most Liked

mmmries

mmmries

It’s working! I have it sampling 10x per second and then I take zones 6,7, 10 and 11 (in the middle) and wire them up to the front 2 RGB LEDs so that they get dim when it senses something close. This will give me a visual indication of what the bot thinks that it sees ahead.

mmmries

mmmries

Now that I have my sensor talking to nerves, there are two follow-up items I need to address:

  1. Update the tmf882x project to use circuit_gpio v2+
  2. Mount the sensor in a reliable way to the trilobot

The first project can be all done in software and involves learning fun new things like how to do host-based testing of an I2C interface, but I’ve been programming all week for work. So I’m going to do the obviously wrong thing and start with project 2

The first thing I noticed is that the Trilobot “leans back a little”, so I put it on a flat surface and measured that the front of the trilobot is about 1cm higher than the back. And since I can’t be bothered to look up the trig I learned back in high school, I just drew a quick sketch in onshape and asked it to measure the angle for me.

Then I grabbed the cad model I had previously made of the Trilobot and copied out the “front board” part, removed the holes for the ultrasonic sensor, and added a tilted face with this same angle.

Then I sketched in the mounting holes based on the TMF8821 datasheet that shows the location of the 3 mounting holes, and cut out those holes from the model.

Exported this to 3mf, sliced it and sent it to my 3d printer. We’ll see in 30min if it fits :crossed_fingers:

mmmries

mmmries

Sparkfun has some helpful resources for this sensor:

The key things to know about this sensor are that it uses a low power laser to sense distance of objects in front of the sensor. It uses some clever techniques to actually measure a grid of distances. There are some tradeoffs between how many measurements there are in the grid and how big the field of view is. I’m planning to use the built-in 3x3 configuration which samples distances 30x per second which should be able to detect both white and dark objects in bright sunlight at a distance of ~750mm.

Where Next?

Popular in Discussions Top

AstonJ
Please see the new poll here: Which code editor or IDE do you use? (Poll) (2022 Edition) It’s been a while since we first asked this, I...
208 31695 143
New
ben-pr-p
In general I’ve been sticking to this community style guide GitHub - christopheradams/elixir_style_guide: A community driven style guide ...
New
Crowdhailer
I’ve been hearing much about the new formatter and it’s something I have been keen to try. I find examples buy far the most illuminating...
248 19740 150
New
pillaiindu
In django there is a cache framework backed by memcached. Rails also puts a lot of emphasis on caching, and even the idea of russian-doll...
New
lorenzo
Hey everone! I created a prototype for my app using Nodejs for the api. But the framework I chose wasnt great (in general theresnt any g...
New
PragTob
Hello everyone, I know we had quite some threads (read through lots of them) about background job processing but it remains a hotly deba...
New
slashdotdash
Phoenix Live View is now publicly available on GitHub. Here’s Chris McCord’s tweet announcing making it public.
New

Other popular topics Top

Brian
What is the proper way to load a module from a file in to IEX? In the python world, doing something like this pretty standard: from ....
New
dokuzbir
I want to highlight html closing tags when i click a html tag. That works in .html files but doesnt work for html.eex templates. How can...
New
Darmani72
If I have a post route which an argument: post /my_post_route/:my_param1, MyController.my_post_handler How would get the post params ...
New
bsollish-terakeet
Credo is smart enough to check for (something like) this: assert length(the_list) == 0 with this response: Checking if an enum is empt...
New
shijith.k
I am trying to start a new phoenix project with elixir 1.9, but mix phx.new does not work. It says that ** (Mix) The task "phx.new" could...
New
sergio
Kind of like when jquery came out, it was super necessary. Existing drag and drop libraries have a bunch of baggage to support old browse...
New

We're in Beta

About us Mission Statement