MirrorBot V3.0 : Robot Autonomie!
Finally there is no need for a computer control screen anymore: the S65-Shield rocks! 🙂
Display Code
This display is fast enough, graphical!!, colorful, just big enough and easy to program,for many tasks, where you normally would need a big (pc) screen and ‘real’ software.
So I started to code an Arduino patch for a mirror bot interface. After some nightly sessions it includes:
- “projection display” – showing the current angle of 2 mirrors and the resulting projection (just some lines and rectangles
- animated BPM “beat-bar” showing current step
- current BPM
- current program name and description
At first, it was difficult to overwrite the previous drawings: if too many lines are drawn at once, it does not work. After some timing tests, I found a working code to redraw all elements without flickering.
One trick is to redraw as few pixels as necessary and another is to reduce the updates to only draw something (over) when its really necessary (something changed).
Servo Control Integration
Then I integrated this LCD animation code into the servo control loops and programs. One control loop runs every 200ms to check the input potis. The display animation update is also triggered in that loop.
Another loop runs according to the current BPM and triggers the selected servo move program which moves the servos on beat.
In manual mode the servos are directly moved in the control loop. Servos do not position soo fast and accurate, so it needs some ms to ‘drive’ there, but it is fast enough for most effects. 50-100ms refresh works good and gives a direct response feeling. Next I’m looking for joysticks, which keep the position, because these jump back to the middle and that’s disturbing in manual mode…
Unfortunately the 4 Arduino analog input pins, which are left free by the S65 shield, are already used up by the four joystick axis.:
S65 Shield Pins Schematics Image
Hotspots Setup
The Duemillanove still had a lot of RAM -1500byte- and 1/2 code memory free, so I started to hack a setup screen for the hotspot variables of two ServoMirrors into it.
Now the box can be configured for each location live ‘on the fly’ without re-programming by a computer. With the joysticks you can select nice spots in the room and press the encoder to save the value. Currently the values are simply stored into global varaibles. Next step is to save these values to SD card or EEProm..
It was easy to write this interface with the S65 library. Simply loop over the variables and draw the text. Draw a box around the selected row and change the selected on encoder turn. Now the box needs some more buttons…
Case
This case was a -fast & furious- test to create at alu-front at home office. Not only that many tools are required, you also need a stand for a drill and equimpment for fixiation to get the metal works really exact. Its not that bad, but it takes long to calculate, drill and saw all holes. You will not get it done without some scratches and unstraight edges, if you dont have a professional workplace.. We are looking for some CNC guys next .. 😉