-
11TC275 Code
The TC275 is a 3 core processor running at 200 MHz and works as the Master on the I2C bus. The file is here: https://cdn.hackaday.io/files/900573852998688/Weedinator_TC275_51.ino
The MCU requires software to be installed on the PC and then becomes integrated with the Arduino compiler so that it can be updated just like an Arduino although the compiler should be run with Admin privileges. More info about the board can be found here: http://www.hitex.co.uk/hardware/boards-modules/embedded-modules-by-processor/hitex-shieldbuddy-tc275/ and there is a very useful discussion forum here: http://aurduino.boards.net/forum
The main part of the code, on core 0, is for controlling the steering and drive motors and runs in one short loop with no interrupts. It relies on one simple 'Micros' timer, breaking down the loop into 'intervals' so that each interval is effectively it's own timer. In this way all the motors are precisely synchronised with each other. The code allows full differential steering and allows for the peculiar offset steering design where the wheel pivet is offset from the Z axis. When turning, the inside wheel slows down according to the angle of the turn, effectively adding torque to the steering mechanism. The code also accounts for which 'lock' the wheels are on and what direction they are swivelling and if the machine is going forwards or backwards.
-
12Create an Online Database
On a remote web server enabled with MySQL and PHP, use phpMyAdmin to create a new database and a new table on that database which should look something like the screenshot above. The ID column needs to 'auto increment'.
-
13PHP Files
Header("Cache-Control: must-revalidate"); $offset = 10; $ExpStr = "Expires: " . gmdate("D, d M Y H:i:s", time() - $offset) . " GMT"; Header($ExpStr); //include ("getid.php"); $host="localhost"; // Host name $username="####################"; // Mysql username $password="####################"; // Mysql password $db_name="####################"; // Database name $tbl_name="####################"; // Table name // Connect to server and select database. mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); // Retrieve data from database $sql="SELECT * FROM ############## WHERE ID = '5'"; $result=mysql_query($sql); ?> // Start looping rows in mysql database. while($rows=mysql_fetch_array($result)) { ?>LAT echo $rows['WAYLAT001'];?>LONG echo $rows['WAYLONG001']; } mysql_close(); ?>
Create a set of PHP files like the one above and label them according to the table ID you want to access so, for example, I might call this one 'waypoint005.php' since it's selecting a line of data corresponding to an Id value of '5'.
When the WEEDINATOR wants to actually travel to way point 5 it will change the url sent to the GPRS SIM 800 module to something like: http://whatever.com/weedinator/waypoint005.php
Header("Cache-Control: must-revalidate"); $offset = 10; $ExpStr = "Expires: " . gmdate("D, d M Y H:i:s", time() - $offset) . " GMT"; Header($ExpStr);
Notice in the above 4 lines there is code for refreshing the PHP data. Currently it is set to refresh after 10 seconds. If this code is not used then you could update the values on the database but the PHP code would only ever download the data once and that value will get stored in memory somewhere for a very long time! (Trust me on this one).
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.