Sign In

Remember Me

RoboteQ MGS1600 MagSensor: Autonomous Robot Control TT-042

Technical Thursday #042

We appreciate robots that have a broad range of applications while being effective in their assigned task. Reliability and precision is key when designing a line following robot, and we carry a sensor that is up for the task! The RoboteQ MGS1600 is a magnetic guide sensor which is capable of detecting and reporting the position of a magnetic field along its horizontal axis. The sensor is intended for line following robotic applications, using a magnetic tape to form a track guide on the floor. Here’s a video example of the MGS1600 with waypoint control: Magnetic line follower.

As shown, the sensor is able to detect 2-way forks and left or right markers given ample space from the center track. This is all done with millimeter resolution! It is highly advised to read through the datasheet for this device before proceeding with your design. Doing thorough research beforehand could save you from a mean headache down the road.

For first time setup and altering configuration settings, download the MagSensor Control Utility and connect the device to a PC via USB. This program can alter critical settings such as magnetic tape width, output mode, and min/max pulse width. The image below shows a setup configuration for basic applications:

MagSensor Settings

The ultimate goal is to use the data output from the MGS1600 to scale the robot’s motor speeds. Within the run tab of the MagSensor Control Utility, the output can be observed while hovering a magnet along the sensor’s horizontal axis. With the example settings applied, the sensor will output a negative value along the left edge while transitioning to a positive value on the right. This position is determined by the peak amplitude of the detected magnetic field.

MagSensor Values

In turn, this data can be used to set up a simple proportional control algorithm to apply a correctional factor to the speed values given to a motor controller. This can be achieved by multiplying a control constant (Kp – this will need to be tuned in order to have a stable system) by an error value provided from the MGS1600, and adding the product to the default speed of your autonomous robot before sending the speed command to a motor controller. For a fully optimized system, a complete PID algorithm should be designed and implemented. However, that explanation warrants a separate Tech Thursday post.

Lastly, interfacing with the MGS1600 can be time consuming. In our video example above, the mecanum robot features an Arduino Mega receiving data from the mounted RoboteQ MagSensor. Below is the MGS1600 library used to communicate with the sensor though Arduino software.

MGS1600.h

MGS1600.cpp

2 Comments

  1. I have been looking for this for a long time! Can I please get a link to download the library files plus an example would be great. I am new to ARduino programming, so I can use all the help I can get.
    Thanks

  2. Here’s the link: https://github.com/SuperDroidRobots/RoboteQ_MGS1600_Arduino_library
    Unfortunately, there isn’t an example we can share at the moment.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Skip to toolbar