Because they are mobile, AGVs and AMRs can be complicated to troubleshoot. Problems can occur during a particular phase of the motion only or under certain undetermined conditions. Resolving these issues typically requires understanding of what exactly the system’s conditions are at the time of the even.
Fortunately, Roboteq controllers include several telemetry features for monitoring the drive during operation.
Smart phones are ideal devices for data logging: they have quasi-infinite storage, are small & lightweight, have long-lasting battery, and are very inexpensive. By now, all of us have one or more unused older generation smart phone which is sufficiently capable for this purpose.
This blog discusses how to use such an Android smart phone to capture operating parameter of Roboteq controllers.
All Roboteq motor controllers are fitted with USB mini B connectors. The controllers are USB Devices and will communicate with a USB Host, typically a PC.
All android phones are USB “On the Go” (OTG) devices, meaning that they can be Devices that can talk to a host, or they can be Hosts and attach to USB Devices (e.g flash drives, mice, …).
A smartphone can therefore connect directly to, and be the host for, a Roboteq motor controller with a simple USB to USB connection.
Robotlog SmartPhone app
To simplify data logging, Roboteq has released an Android app which performs the following
- Automatically scan the USB port and detect the presence of an active Roboteq motor controller
- Create a new log file every time a new connection is detected
- Capture all the text characters output by the motor controller and save them to the phone’s memory
The app can be downloaded from here.
The Robologger App
Screen stays idle if no controller is connected or running.
New file is created and screen updates with file size and location information
Data Logging Script
Scripting is a powerful feature that is incorporated in every Roboteq motor controller. One of its uses can be to send selected operating parameters (speed, amps, counts, …) at periodic intervals.
The script below will send a time stamp in milliseconds and up to 5 parameters, separated by tab characters. The tab character is the preferred separator as it allows easy copy & paste of the log into an excel or google spreadsheet for analysis
The choice of parameters to be logged can easily be changed in the definitions part at the beginning of the code. The repeat rate can also be user defined. Up to 20 parameters can be logged by uncommenting and modifying parts of the code.
The script also makes it possible to capture a log only when one of the parameters is within a predefined minimum and maximum value.
The script must be configured to start automatically upon the controller powering up. This done by changing Startup>Scripting>Script Auto Start to Enable.
With the smartphone connected and the Robolog app running, logging will automatically take place when the controller is restarted.
When data is bein logged, the file size’s can be seen increasing on the phone;s screen.
option explicit ' ' Modify parameters below to configure what gets logged and how fast ' #define NbrLogs 5 ' Number of parameters to log. Change as needed up to 10 max #define Interval 10 ' Milisecond intervals between logs. Use 10ms or higher preferably #define TrigChannel 0 ' Use 0 for unconditional log. 1 to NbrLogs for conditional log #define LowLimit 600 ' Low and high limits for conditional logs #define HighLimit 1000 ' Log 1 Parameter and channel #define P1Param _P ' Change parameter to log as needed #define P1Ch 1 ' Change motor channel as needed ' Log 2 Parameter and channel #define P2Param _S #define P2Ch 1 ' Log 3 Parameter and channel #define P3Param _A #define P3Ch 1 ' Log 4 Parameter and channel #define P4Param _C #define P4Ch 1 ' Log 5 Parameter and channel #define P5Param _T #define P5Ch 1 ' Uncomment code inside main loop to use more than 5 logs ' Log 6 Parameter and channel #define P6Param _T #define P6Ch 1 ' Log 7 Parameter and channel #define P7Param _T #define P7Ch 1 ' Log 8 Parameter and channel #define P8Param _T #define P8Ch 1 ' Log 9 Parameter and channel #define P9Param _T #define P9Ch 1 ' Log 10 Parameter and channel #define P10Param _T #define P10Ch 1 ' ' Do not change anything below this line ' dim L[NbrLogs] as integer ' room for 20 max number of logged parameters dim Ch as integer dim TimeCount as integer dim TimeStamp as integer dim TCh as integer TCh = TrigChannel -1 SetConfig(_SCRO, 2) ' Force script output to USB port print (TimeCount,"\t",TimeStamp,"\r") wait(1000) ' wait 1s after power up before logging print("start logging...\r") SetTimerCount(1, 1000000000) ' Load timer with large number for infinite countdown TimeCount = 0 top: TimeStamp = 1000000000 - GetTimerCount(1) ' Use Timer as Time Stamp for better accuracy if TimeCount <= TimeStamp TimeCount += Interval L = getvalue(P1Param, P1Ch) L = getvalue(P2Param, P2Ch) L = getvalue(P3Param, P3Ch) L = getvalue(P4Param, P4Ch) L = getvalue(P5Param, P5Ch) ' uncomment below as needed ' L = getvalue(P6Param, P6Ch) ' L = getvalue(P7Param, P7Ch) ' L = getvalue(P8Param, P8Ch) ' L = getvalue(P9Param, P9Ch) ' L = getvalue(P10Param, P10Ch) ' copy and modify the above to log more parameters if TCh = -1 ' Unconditional log gosub sendlog else ' Conditonal Log if L[TCh] > LowLimit and L[TCh] < HighLimit ' Edit this line for different or more complex condition gosub sendlog end if end if end if wait(1) goto top sendlog: print("\t", TimeStamp) for Ch = 0 andwhile Ch < NbrLogs print ("\t",L[Ch]) next print ("\r") return
Acessing and analysing the Log Files
The Robolog app stores the logs at the following location.
From there they can easily be emailed to a PC for more convenient analysis.