A program which uses the ATOM Motion to track the sun (or other light sources).
The solar tracker will be constructed using Lego bricks where possible.
- A plethora of Lego Technic pieces
- 1 x M5Stack ATOM Motion
- 1 x M5Stack PaHUB2
- 4 x M5Stack DLight
- 2 x M5Stack Unit Limit switch
- 2 x Kittenbot Geekservo continuous rotation servos
The M5Stack ATOM is the MCU/processor for this project.
The ATOM Motion bas gives it the ability to control the two servos. It has an internal PWM controller that uses the default I2C.
The PaHUB2 is an I2C multiplexer that I have connected to PORT.A on the MCU. It connects to the DLight sensors and polls their readings. Because of the ATOM Motion PWM controller, a second Wire instance is needed for PORT.A. This is managed using the TwoWire class in the code.
The two limit switches connect to PORT.B and PORT.C on the ATOM Motion. These tell the MCU when the altitude servo should stop moving. One limit switch tells it when to stop moving up, and the other tells when to stop moving down.
- ATOM Lite HY2.0-4P:
-
- G, 5V, G26, G32
- PORT.A (onboard), 32 White/SCL, 26 Yellow/SDA
- Default I2C:
-
- SCL 21
-
- SDA 25
- Seems to use this button library: https://github.com/m5stack/M5Atom/blob/master/src/utility/Button.cpp
It may be required to call M5.begin() before atomMotion.Init()
M5Stack ATOM Motion notes:
- Library
- PORT.B (black connector), 23 white, 33 yellow
- PORT.C (blue connector), 19 yellow, 22 white
- Servo angle range 0 ~ 180 (unknown how 360° servos behave, but continuous rotation servos work just fine)
- Servo pulse width range: 500-2500
- DC motor speed range -127~127
- APDS-9960 default address: 0x39
- ATOM Motion servo:
- Has four servo ports, numbered from 1 to 4.
- uint8_t SetServoPulse( uint8_t Servo_CH, uint16_t width );
- Seems to return 0 on success, and returns 1 on error.
- uint8_t SetServoAngle( uint8_t Servo_CH, uint8_t angle );
- Seems to return 0 on success, and returns 1 on error.
- Servo(1~4) angle: 0-180 pulse: 500-2500 R/W
M5Stack PaHUB2 notes:
- Library
- This project the PaHUB2 connected to PORT.A (the onboard HY2.0 port of the ATOM Lite).
M5Stack Dlight sensor notes:
- I2C address 0x23
- Library
- Values from 1-65535, greater values represent brighter light.
- This project uses 4 M5Stack DLight sensors connected to the PaHUB2.