Maxbotix XL-MaxSonar-EZ MB1240 - Working RS232?


5 posts
by DeckerEgo » Mon Jan 20, 2014 2:45 am
It seems like Maxbotix' XL-MaxSonar-EZ MB1240 is a bit of an odd bird for the RaspPi. You have a choice between analog or RS232 Vcc0 connection; the pulse width output also seems to be analog. Of course the Pi doesn't have any analog inputs without a breakout board, so the fallback is the RS232 output. It is documented by Maxbotix at http://www.maxbotix.com/articles/074.htm, however those steps do not work for me. I think they might be using TTL instead of RS232, which the MB1240 does not appear to support.

UART expects inverted RS232, as bredman noticed in an earlier post (http://www.raspberrypi.org/phpBB3/viewtopic.php?p=191545#p191545). There isn't really a software solution it seems, because you have to also invert the stop/start bits. Or maybe there is using the WiringPi serial library?

I'm happy to use either pulse width representation or RS232, but it seems that the Pi supports neither. Any good ideas on how this proximity sensor might work? Or do I need to rely on some other analog/digital bridge?
User avatar
Posts: 18
Joined: Sun Oct 27, 2013 2:08 pm
by DeckerEgo » Mon Jan 20, 2014 10:28 pm
Unless anyone has an easier way, I have an Adafruit 5v Trinket I'll probably just use to convert the analog signals to UART or I2C. Anyone have an easier way to cobble the MaxSonar 1240 to a Pi?
User avatar
Posts: 18
Joined: Sun Oct 27, 2013 2:08 pm
by FLYFISH TECHNOLOGIES » Mon Jan 20, 2014 11:00 pm
Hi,
DeckerEgo wrote:Any good ideas on how this proximity sensor might work?

I'd read RS-232 output, but you need to add an inverter. You could take a ready-made inverter chip (eg. MC74VHC1GT14) or make it by yourself with a transistor (eg. 2N7002) + two resistors (eg. 2x4k7).


Best wishes, Ivan Zilic.
Running out of GPIO pins and/or need to read analog values?
Solution: http://www.flyfish-tech.com/FF32
User avatar
Posts: 1750
Joined: Thu Oct 03, 2013 7:48 am
Location: Ljubljana, Slovenia
by DeckerEgo » Tue Jan 21, 2014 4:04 am
Indeed, the MC74VHC1GT14 logic inverter seems like the way to go. I'll tinker with the Trinket, but I do believe you're right that the inverter is the way to go.
User avatar
Posts: 18
Joined: Sun Oct 27, 2013 2:08 pm
by DeckerEgo » Tue Feb 11, 2014 2:25 pm
To follow up - I ended up scavaging an NPN transistor from an old ethernet hub, grabbed a few resistors and built my own logic inverter. As soon as I did that - blammo! Worked fantastically!

Thanks!
User avatar
Posts: 18
Joined: Sun Oct 27, 2013 2:08 pm