Monday, August 3, 2020

Tilt! - A Balancing Robot (#5) - Initial wiring and software for testing


The first leg is completed and structurally sound enough to start testing the wiring and software needed for control.  (hmmmn... did I say leg?)

Tilt! Balancing Robot - first prototype leg

over the past weekend, I found many many videos on YouTube for Balancing Robots. There seem to be dozens of them!  The majority of these are copies of other projects, just re-implemented. Even less of these videos support code to help in the own development.  And with inspection of these codes, the majority are copies of the same code. It makes me wonder, who is the originator of this code base that is getting copied so many times?

Cargo Programmer

A Cargo Programmer is a person that copies code and scripts off the Internet and tries to build a system without fully understanding it. In 2020, this seems to be massively popular. Sites like StackExchange and the many Instructables and Git repos make this almost too easy.  The biggest concern is that these 'cargo programmers' do not understand the logic and activity behind the code.

The origination of the term is from the concept of Cargo Cults. Now we see that same concept being applied to 'magic technology' that is appearing on the internet. Same concept goes back to nomenclature of 'Script Kiddies', who were n00bs! that just cut and paste computer hacking code without really being a Computer Hacker. The point is, examples and code on the internet is great - but please take the time to understand them as you use them!

Mea culpa

OK OK! after all that ranting - for my first tests, I will do the same thing!!  Just to get things started and to learn more about the systems. However, I did take time to examine each of the libraries and code to make sure I understood it. As well as had to do some minor adaptation for my hardware.

In searching the internet and git, there are a few copies of the exact same code. I found that Makertut, has the code on git, and even though it is clearly copied, it is cleaner than some of the other code sets (even from James Bruton) for this project.  Then I was surprised to find it was a copy of kurimawxx00.  So, who was the original, (Frank?) honestly I don't know and I don't think it was either of these.  They both contain code for a motor controller LMotorController - in which I can not find the original creator.  It is simple code to control output on a L298N H-bridge, but why have special code for that?

Special shout-out, through my internet searches I have found that Dinh Tung “Tony” Le, AKA mechatony, Gets some special credit. He gets extra credit as he had to build all of the libraries from scratch in order to get school credit for his project. Tony has removed his code from the internet. But the explanations of the difficulties of this task are spelled out in his videos. this concept was often overlooked by the 'copies'.

#include "PID_v1.h"
#include "LMotorController.h"
#include "I2Cdev.h"
#include "MPU6050_6Axis_MotionApps20.h"

The result after all of this, I was able to install and compile the basic libraries for MPU6050, I2Cdev, and PID (and LMotorController - roll eyes!). The guys that wrote these libraries are awesome for their support of the maker community.

With some (also copies) example code, I was able to get my test leg moving and reacting to the pitch change of the MPU6050.  The motor accelerated with the larger pitch and reversed when pitching backward.  This is the basic proof-of-concept needed at this stage of the rapid prototype.

Next steps

Print out and assemble the second leg of the Robot (see image), and then design the chassis or mounts for the microcontroller, mpu6050, and L298N H-Bridge. for a battery I will be using a Talentcell 12v/5v battery bank.

Tilt! Balancing Robot - Prototype layout

Here you can see all of the components that will be part of Tilt.  Notice that the motors, belts, rods, rubber stoppers, and screws are all recycled from Printers.  Also, the bearings are from discarded inline skates.

One can dream...

No comments:

Post a Comment