https://github.com/jjbel/light_navigator
Move to the brightest point in the room
https://github.com/jjbel/light_navigator
arduino mechatronics
Last synced: 4 months ago
JSON representation
Move to the brightest point in the room
- Host: GitHub
- URL: https://github.com/jjbel/light_navigator
- Owner: jjbel
- Created: 2025-01-08T15:24:46.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-01-19T08:56:12.000Z (over 1 year ago)
- Last Synced: 2025-08-01T14:52:04.479Z (10 months ago)
- Topics: arduino, mechatronics
- Language: C++
- Homepage:
- Size: 33.2 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Light Navigator Bot

Move a bot to the bright spot on the wall in a dark room
###
Development process:
1. Took code from circuitjournal, removed all unnecessary code except that which sends grayscale image over UART
2. inspected the pixel reading code to find a place to insert pixel processing
3. debug upload timing issues
4. get the motors working, being conservative with number of pins used (as I ran out of available arduino pins)
5. tune the rotation and forward movement parameters
Algorithm:
1. We only care about horizontal movement, so rotate the camera 90 degrees so each pixel row is vertical
2. store each row in a buffer, take the average of each row (call this it's brightness)
3. if the light is on the left, the beginning rows are brighter
4. turn by an amount propotional to the angle of the light from the centre axis
5. move forward
Bugs:
1. Don't disturb the UART upload process
2. KEep the checksum which is verified by circuitjournal's extension
3. Usin pin 11 for PWM caused timing issues, maybe because it is also use for I2C?
### Downsampling ideas
Max pooling
store n lines, average over n lines, so 2^n size reduction
bot can only turn horizontally. vertical resolution not needed. can orient camera such that one line is vertical, then can greatly downsample line, maybe even take average.
or take average sport
or find the centre of mass
take the middle line with max value.
but just taking max value is susceptible to noise.
could set a threshold, pixels above it should be counted.
auto exposure: could be helpful to control it manually?
possible optimization: reduce no of memory accesses to buffer
OI!!
just print the avg value at the end of the line
forget trying to set the image to it