CPX 3D Boat
CPX stands for Circuit Playground Express and is a piece used in the project that has a moving part that is controlled by a servo motor. Students can quickly become familiar with computing traditional codes with Circuit Playground, a family of microcontroller boards that have LEDs, buttons, and sensors built in. Our product required a 3D-printed casing and attachments. A minimum of three different sensors or buttons are used in the CPX code to activate lights and sounds. The code for our first project was written in CPX, so we must update it in Python, which is a different programming language.
Supplies
- Adafruit Circuit Playground Express Basekit
- Circuit Playground Express
- USB cable
- 3 x Alkaline AAA batteries
- 3 x AAA Battery Holder
- Continuous Rotation Micro Servo
- 3D printer
- MU Editor Application
- Access to tinkercad, Thingiverse, and MakerBot websites
Creation of the Design
- https://www.tinkercad.com/things/5eWYc9yXUpM-mighty-blad-bigery/edit
- The first step of this process is to brainstorm an idea of what you are interested in 3D printing. Once an idea is decided amongst a group, you can look for other ideas on Thingiverse, which is a site that includes many other 3D printed ideas that you can download and then make it unique to your own design.
- Once you have your ideal pieces downloaded, you can upload your ideas to another site called Tinkercad, which allows you to create your own idea while having the ability to change sizes, shapes, placements, and many more.
- Once you have created your ideal design, you will download it to your computer where you can then 3D print it. Your design should be downloaded to a folder that is easily accessible which can then be transferred over to a USB which will then connect to your 3D printer. Once it has successfully been transferred to the USB, you can begin printing your pieces.
Using the CPX and Servo Motor
- CPX is a hardware board with Neo pixels, sensors (temperature sensor, light sensor, sound sensor, etc), and buttons. In this project, the role of the CPX is to
- Use jumper wire alligator clips to connect the ground wire to GND, the power wire to VOUT, and the signal wire to A2 on Circuit Playground Express
Final Steps
- Once all of your pieces are printed, you can then attach your CPX to the given area on the boat as well as the Servo Motor. There is a spot for each of these inside the boat where they can properly sit.
- Once everything is in place, you can then attach the roof of the boat to protect the wires as well as the CPX.
- You can then turn on the Motor and your boat will then work when dropped onto a platform, water, hand, etc.
Printing
- Download and print the following STL files using a 3D printer. Use a raft and supports.
- Remove supports using cuticle cutters
- Upload the STL file or provide a link to Thingiverse
Show photos of the TinkerCAD files and of the printed product
https://cloudprint.makerbot.com/print
Coding Example
- Follow these instructions to install CircuitPython onto your CPX: https://learn.adafruit.com/welcome-to-circuitpython/installing-circuitpython
- The code is written in circuit python and more information about this coding language can be found on the Adafruit website. The purpose of this high-level programming language, CircuitPython, is to make it easier to read, write, and maintain. It supports modules and packages, so you can reuse your code for other projects. Since it has a built-in interpreter, you do not need to perform any additional steps, such as compiling, in order to run your code. You can use, modify, and improve Python for free since it's Open Source Software.
- Connect your CPX to your computer and save code.py onto it
- Circuit Playground Express can be connected to your computer with a micro USB cable. The code below should be copied and pasted into the Mu Editor. When you click the Save button in Mu, your code will be saved to the CIRCUITPY disk drive (which appears when the Circuit Playground Express is connected to your computer) as code.py. It won't run if you name it anything else so code.py is the recommended name.
- The provided code will:
- Use the CPX to move the servo motor connected to pin A1 to 90° in the on_start loop. By doing this, the rudder will always start from the same position and point straight backward. As part of the free fall loop, we instruct the servo to make 100 movements back and forth with a pause of 1/10th of a second between each. After 100 flaps, the servo returns to its 90° starting position. To create the flashing blue and green lights, the on button b click is used to have the colors repeated 20 times. With button a, a melody was created and gets played at the loudest volume which is repeated four times