I want to connect a Hokuyo scanning range finder to an Arduino Mega, the outputs are labeled like this:
- COM+
- COM-
- Input
- Output
- DC12/24
- GND
I want to read its serial output with Arduino, please help me in details. Thanks
-
Have you looked at the hardware documentation of the device you are trying to connect to, normally this will provide details on how to connect and interface with the COM PortsHarvey– Harvey2016年05月23日 13:47:05 +00:00Commented May 23, 2016 at 13:47
-
2Failing @Harvey's suggestion, you will at the very least need to specify the exact model of the device you are trying to interface with. But I suspect this will be off-topic here anyway; Super User is concerned with using computers from a user perspective, not programming or hardware design.Michael Kjörling– Michael Kjörling2016年05月23日 13:58:15 +00:00Commented May 23, 2016 at 13:58
-
There are many protocols involved in COM programming also, so also a very broad questionHarvey– Harvey2016年05月23日 13:59:41 +00:00Commented May 23, 2016 at 13:59
1 Answer 1
You should specify what model of Hokuyo scanning range finder you have. Some models are USB-interfaced, in which case COM+ and COM- could possibly correspond to USB D+ and D- leads.
The Hokuyo URG-04LX has both USB and RS-232 interfacing. The linked page shows the following pinout on CN1:
Pin No. Signals Colors
1 N.C. Red
2 N.C. White
3 OUTPUT(Synchronous output) Black
4 GND(5th pin of 9-pin, D-sub connector) Purple
5 RxD(3rd pin of 9-pin, D-sub connector) Yellow
6 TxD(2nd pin of 9-pin, D-sub connector) Green
7 0V Blue
8 DC5V Brown
Given that pinout, you would connect pin 5, RxD, to a TXD output on the Mega, and pin 6, TxD, to an RXD input on the Mega. Note, before making any such connection, measure the output voltage on pin 6. An ordinary Mega supports 0 V and 5 V levels for serial data, but standard RS-232 levels are lower and higher than that; for example, ±12 V. If you connect ±12 V RS-232 levels to your Mega, you will damage it. The several Hokuyo documents I've looked at don't say whether they use traditional RS-232 levels (±12 V) or TTL levels (0-5 V).