IDEA
This final project idea came about while I was teaching a Computer Science class to high school students this last year. We were learning about the Python programming language using the Turtle module to draw simple graphics/animations. Turtle graphics essentially draws on the screen using a sprite which is positioned and moved relatively in a cartesian plane. The path routed by the sprite can be displayed or not. Basic shapes can be drawn through a series of commands consisting of forward moves, rotations by a specified angle, and pen visibility state changes. There are more complicated commands, but a surprising amount of content can be created with these incredibly basic set of instructions.
DESIGN CONSTRAINTS
I decided to start with the most basic needs of the design, moving forward and backward and rotating in a controlled manner and actuating a pen/pencil/drawing device. As far as aesthetics, I'd like it to resemble a turtle on some level. I figured the pen actuation would be easy to add on to a chassis, so my first concern was the frame design and the movement mechanism. With minimalism in mind, I decided to go with a two wheeled design with the axle at the center of the frame and simple friction sliders to keep the chassis level. This way all I have to concern myself with is the control of two motors in order to get rotation about the center and forward and reverse movement. It's a turtle, so it doesn't have to move very quickly. Going with the idea of simplicity and minimalist, I wanted to use components on hand in our lab. My motor choices came down to 90 degree gearbox dc motors or small steppers. I decided to look into what electrical hardware and program code would be needed to drive each of these motors.
90 degree motor img
stepper motor img
ELECTRONICS
Keeping the idea of modularity and minimalism in mind, I decided to make an Arduino inspired breakout board for the ATTINY44. That way I could test out different components easily and make daughter boards as needed.
IMAGES
MOTORS
I was able to get both motors moving under control and was left pros and cons on both sides. The stepper motors would provide more precise positioning and allow me to potentially use GRBL so that I could control the turtle with G-Code (an exciting idea), but this would require using an ATMEGA328P or similar microcontroller for the main controller and fabricating stepper drivers to operate each motor. On the other hand, the DC motors could be driven more simply by using pwm and a couple H-Bridge drivers (we have these on hand), but sacrificed the ability to precisely position and control the turtle without any additional hardware. I actually began working on stepper motor driver boards, but decided to switch back to using DC motors after having issues getting the stepper driver program code to work properly.
After finally settling on my motor choice, I designed the chassis around these components. I drew up a prototype in Corel draw and laser cut the pieces out of plywood and glued everything together. After a couple iterations to work out the kink, I had my motors mounted in a chassis and was ready to start
MOVEMENT CONTROL
So I had figured out how to drive the DC motors at varying speeds using an H-Bridge and PWM from the ATTINY44. Debugging using serial communication was a great help in that process. I was able to get to motor speed and direction correlated to the position of a potentiometer. This made for the first drive of the turtle, operating it like a tank, with each slide pot controlling the direction and speed of the respective motor. While this was quite enjoyable, and proved the concept, it left me with a leash on my turtle. With my knowledge gleaned from this process, I decided to try another method of control, sending characters over serial that would make the motors move a set amount. I simply used an ftdi adaptor and Neil's initial serial communication code to send characters, knowing I could replace the FTDI adaptor with a bluetooth module down the road.
Developing the control firmware consisted of a lot of frustration. It's still far from perfect, but finally came together to a working state.
WIRELESS CONTROL
Now that the turtle is moving, my next task was to unteather it from my computer and go wireless. After looking at different options, I decided a simple bluetooth module would be the best fit (and we had one on hand in the lab!). That way I wouldn't need to alter my control firmware, the TX and RX would simply be coming from the Bluetooth Module instead of the FTDI chip. And so I learned about the weird world AT COMMANDS and finally got my bluetooth module properly configured and connected. The turtle was moving without a wired data connection! Still teathered, but the power supply is at the bottom of the to-do list.
PEN MECHANISM
With movement and communication working, the next task I set myself to was designing the pen actuating mechanism. After considering a number of different mechanical designs, I decided to go with a rack and pinion gear set. I could drive the pinion with a servo in order to get repeatable potitioning of the rack gear, and I could make the rack gear large enough to contain the pen holder. I started with a 3D printed prototype and frame to make sure test things out. I used one of my Tiny Breakout Boards to tune the servo code. I wasn't sure if I'd need an extra Tiny Breakout board to control the servo position. I just had my motor control firmware working and didn't want to mess it up by adding the servo code.
POWER SUPPLY
Simple 5v regulator to provide 12V and 5 V. I decided to buy a battery pack with all of the charging and control hardware built in. I figured I'd go with something professionally designed for the component that could catch fire. I took apart a cheap portable rechargable battery pack ordered on Amazon. It fit the form factor of my turtle
BRINGING IT ALL TOGETHER
Now that all the parts were in place it was time to step back and take a look at how to integrate everything together into a concise package. I went through a few iterations of mold ideas for creating the turtle shell, but was eventually decided to redesign the chassis in a boxier fashion that more easily facillitated the flexible layout of internal parts. I can always make a lightweight composite shell that covers the boxy chassis down the road. Upon redesigning the chassis, I realized I could integrate the rack and pinion directly into the base frame of the turtle. Things were coming together nicely.
pictures
I decided to cut the shell out of acrylic so that the power and signal lights on the boards would be visible
With the shell and components finalized it was time for final placement and securing everything in place. Some deftly placed hot glue was perfect for my purposes. Finally I created some custom header fittings to tidy up the wiring and cut some vinyl stickers to seal up the turtle but still provide access for debugging purposes.
FINAL THOUGHTS