This instructable was created in fulfillment of the project requirement of the Makecourse at the University of South Florida (www.makecourse.com).
This project is a device that saves a 16-character message to be displayed again when the proximity sensor is triggered, along with rotating its arms. The functionality is similar to a Gyroid from Nintendo's Animal Crossing game, so I based the design on this character.
Step 1: Step 1: Tools and Materials
Things needed for this project:
- Access to a 3D printer
- Dremel tool
- Hot Glue Gun
- 1x Arduino Uno R3 Microcontroller
- 1x 16x2 LCD Character Display w/ I2C backpack
- 2x Tower Pro servo motors
- 1x HC-SR04 Ultrasonic Range Sensor
- 1x IR receiver
- 1x IR remote
- 1x Mini Breadboard with 1 set of power rails
- 2x 100 μF Electrolytic Capacitor
Step 2: Step 2: 3D Files
I designed the parts using Autodesk Inventor 2016. I have attached the STL files and the modifiable Inventor files.
There are two sets of files: Large and Small. I initially designed it to be bigger, but had to shrink it in order to meet the maximum part dimension requirement of the course
Check the dimensions of your LCD and proximity sensor, and make sure the slots are large enough for them. My LCD slot printed a little small so I had to dremel it out. Also, depending on what you decide to power the arduino with, you may want to move or enlarge the hole in the back. Plan this out now so you don't have to do more work later.
You will need to print:
- 1x Hat
- 1x Body (split into 2 parts in the small version)
- 1x Base
- 2x Arms
Step 3: Step 3: Control System
Use the Fritzing Diagram to help with wiring the system, because it'll get messy. I also included a control system block diagram to help visualize each component's role in the system.
Echo: Pin 8
Trigger: Pin 9
Pins 3 and 4
Connect power and ground across the capacitors, as shown in the Fritzing sketch
SCL and SCA pins
Everything, except for the servos, is connected to the power and ground rails normally.
Step 4: Step 4: Code
I attached the Arduino code I use to run the project. You'll need to configure your own hex codes for your remote, so open up the serial monitor and you'll see the hex code of each button you press. Replace my values with your own.
The "pitches.h" file included isn't used in any of the main functions, but just as a fun extra for the buzzer. I have it set to play a little tune when the info button on my remote is pressed. You can remove that function and pitches.h and it won't affect normal operation of the Gyroid.
The interface functions in the code are displayMenu(), menuSelect(), and the menu navigation functions. These are used to display the menus and start the core functions at the appropriate time.
setMessage(), displayMessage(), and clearMessage() work directly with the message array, while sleep() and setDistance() handle putting the device to sleep and waking it up. motorTest() is what drives the rotation of the arms.
There are comments throughout the code to help understand what I'm doing in each function.
Step 5: Step 5: Assembly
Time to put it all together!
1) Depending on the dimensions of your components, you may need to dremel the LCD, proximity sensor, or power cable slots to be larger. Do this with caution, as a good dremel tool can cut through plastic like butter. I'd recommend doing your own measurements and editing the part file before printing, so you don't have to go through the extra trouble.
2) Optional: paint. I used spray paint from home depot to get the right color on the Gyroid and the base, since the colors weren't available as filament. I think the paint makes it look better anyway.
3) Hot glue a servo connector to the flat side of each arm. Make sure that it is centered. The servos need to be hot glued to the inner wall of the Gyroid. Position them in such a way that the rotating gear is in the center of the cutout. If you printed the smaller version, you will need to glue the top and bottom halves of the body together.
4) Let the glue dry, then attach the arm to the servo and make sure it rotates without hitting anything. If there are any problems, hot glue is easily removed without damage to the components.
5) Carefully Insert the proximity sensor and LCD into their respective slots, and arrange the arduino and breadboard so that they fit. As you can see from the included picture, it'll be tight. I removed one of the power rails on the breadboard and placed it against a wall.
6) Plug in the Arduino's power plug, running it through the hole in the back.
7) The Gyroid should snap into the base. I wouldn't recommend gluing these together so you can still access the components.
8) I glued black paper behind the eyes and mouth to make it look better. You can use whatever you want for this, as long as it's black.
9) Place the hat on its head. Your Gyroid is now fully assembled!