So i feel a little bit uncertain how I can add components to the magni.
I am looking to connect a 24GHz Radar: https://wiki.dfrobot.com/24GHz_Microwave_Radar_Sensor_SKU:%20SEN0306
and I want to keep the sonar sensors attached. Is that possible? Because the raspberry pi is connected to them using a belt cable.
Edit: Does this mean I have to sacrifice the sonar sensors to add the radar sensor?
No actually that radar sensor seems to be using the serial connection to work, so to use that you’d have to remove the motors to do it with existing hardware. The Pi uses its sole serial line to talk to the MCB. And if you’d want to access the gpio pins you’d have to remove the sonar board connector as it’s blocking access to it.
The most practical way of adding more sensors is via the 4 USB ports on the Pi or its Ethernet port.
So in this case you’d probably best go with an USB FTDI (or any kind of USB to serial dongle) which would add another serial interface and then link the radar to that. That’s likely to be the easy part since you’d still need software support for it.
1 Like
Thank you!! I was wondering if you could point me in the direction of a possible documentation or tutorial of how to do this?
Thanks again!
In short:
- get one of these things
- connect the pins with the same names with the sensor
- find the device name by checking in /dev, where it should start with tty, likely to be
/dev/ttyUSB0
- you may need to set the port to raw mode, something like
stty -F /dev/ttyUSB0 115200 raw
- get the arduino code posted on the site you linked and rewrite it to run on the Pi, while using the specified port for serial
That should be about it, although the last step will require a fair bit of programming knowledge, you basically have to port the driver from arudino to the pi. I at least can’t seem to find an existing one you could use at this time.
And if you’d want to use the sensor with ROS and the rest of the magni, you’d have to write the driver in either Python or C++ and set it up to publish sensor messages.
1 Like
Ohh okay, can I also do something like Arduino serial where I simply read whatever the Arduino is reading?
basically, the Arduino would be detecting the distance of the object and simply I would read that from the Arduino, and publish the distance values to a topic that I can use?
Or is that what you said? I am sorry, I am relatively new to this.
Thank you for your help again!!
edit: I do have one of those things as well!
Uh sure, you can also do it that way, then connect the arduino to the magni via USB and set up a script to read the arduino’s serial outprints. Keep in mind that you’ll need to note which arduino serial goes through the USB and which out of the pins, sometimes they’re the same which would be a problem. Anyhow you’ll need to have the existing code use the gpio serial and then send the read data through a different serial via USB.
That might be easier to code, but either way you’ll need something on the Pi side to turn the radar data into a ROS compatible message.
This is going to be a rather involved project if you choose to do it, but it may be a good one to learn how the systems work.
I was wondering if there is a tutorial which could explain how I can make a driver for the Radar? or how can I convert the data I am collecting to be processed by ROS?
EDIT:
I have found a radar with ROS drivers, the only issue is the price… So I will try to stick with a tutorial for now. if there is?
I mean if there was a tutorial on how to make this specific thing it would already exist, given that whoever wrote the tutorial had already done it. I’m sure you can find instructions on how to do the various subtasks you’ll have to solve along the way. Half of programming is just knowing what to google for.
1 Like