EGO robot
2023-07-02 | By M5Stack
License: General Public License Robot Kits Arduino M5Stack
* Thanks for the source code and project information provided by @Framework Labs
Software apps and online services
About
Ego is a little robot build from LEGO parts (especially LEGO Technic parts) using M5Stack sensors, motors and compute units.
The robot can either be remotely controlled from a M5StickC with the Joystick HAT or it can drive autonomously avoiding obstacles by using the ToF Laser HAT.
Usage
Turn on the robot by switching the ATOM Motion switch to on. The two LEDs of the onboard nodes will begin to blink orange until a connection to the configured WLAN can be established.
The LED of the main node will first turn red indicating a stopped state. Later, it will become either green in MANUAL or blue in AUTO mode. The LED on the node of the ranger unit will show either red, yellow or green depending on how far it can range ahead.
Now turn on your M5StickC. It will first try to connect to your WLAN and indicate this on the LCD screen. It will then transition into a screen which allows you to select either MANUAL or AUTO mode. A single press on the M5StickC button will enter the MANUAL mode - a double press the AUTO mode.
When in MANUAL mode, use the joystick to direct the robot. When the robot drives ahead, the front light will shine white and the backlight red. When you drive backwards, the backlight will blink red. Driving left or right will turn on yellow blinker lights on either side of the robot. To prevent hitting a wall, the range sensor is also active in MANUAL mode and will stop the ego device when it detects an obstacle in proximity (8 cm away or less). Try driving backwards in this case ;-) To stop the manual mode, either press on the main button or the button on the Joystick. Note, that the LCD display will dim down after 5 seconds so pressing on the main button will first wake up the display - press again in this case - or use the Joystick button right away.
When in AUTO mode, the robot will drive straight ahead until it detects an obstacle less than 30 cm away, in which case it will turn either left or right until it sees enough free space ahead and continues to move in this direction. When it traveled for more than 5 seconds straight, it will remember to toggle the turning direction when it approaches the next near obstacle. Stop the AUTO mode again with pressing either the main button of the Stick or the Joystick.
You could also activate the two modes directly on the Robot by pressing the blue button once for MANUAL mode and twice for AUTO mode. Pressing the red button will stop the ego vehicle. The UI on the Stick will then reflect the decisions made by the buttons on the robot.
To turn off the ToF Laser - e.g. when charging - you can press once on the button of the ATOM light to which the ToF HAT is connected. Its LED will then blink white. Press again to reenable ranging.
Build up
In the following, I describe the wiring of the different M5Stack components - as far as the LEGO build up is concerned you are free to build whatever you like. Just remember that the robot uses a tank drive system - i.e. to turn left or right it drives the two servos with different speeds (pulses).
Connect the left Servo 360 to PORT S1 of the ATOM Motion and the right Servo to PORT S3.
Attach the ToF HAT to the ATOM Light via the shipped adapter and connect the ATOM Light via the Grove port to PORT B of ATOM Motion.
Connect the head RGB LED unit to the Grove PORT on the ATOM Light placed on the ATOM Motion and chain the back RGB LED from the head RGB.
Finally, connect the Dual Button unit to PORT C of the ATOM Motion.
For the remote control - attach the Joystick HAT to the M5StickC and fix it with a little bit of transparent tape for better mechanical stability.
Steering Front Wheels
Instead of steering like a tank, the variant shown below sees the front-wheels with a separate 180° servo. Use the acker branch of the repo for this set-up.
Code
https://github.com/frameworklabs/ego
Misc
This project uses proto_activities which is a programming concept inspired by the imperative synchronous programming language Blech.
Have questions or comments? Continue the conversation on TechForum, DigiKey's online community and technical resource.
Visit TechForum