Mini Cybertruck (2021)
I decided to enter the competition not for the competitive aspect but for the learning opportunity and the experience. I’ve noticed the best way to learn something is through projects and innovation so this is my way of learning!!!
​
As a part of the competition, I will include my coding development and my mechanical design development in photographs (on the left) and in a separate page here!!
Github Link for relavant code:
ImaginIndustries/Mini-CyberTruck (github.com)
Step 1: Getting Acclimated
![Setting Up Variables](https://static.wixstatic.com/media/a9d1bf_18981c6b8cca416c838e5778b76b427a~mv2.jpg/v1/fill/w_980,h_598,al_c,q_85,usm_0.66_1.00_0.01,enc_avif,quality_auto/a9d1bf_18981c6b8cca416c838e5778b76b427a~mv2.jpg)
The code above identifies the variables in the code such as to what pin does "blank" motor corresponds. Also providing an output code to both forward and backward pins is what allows the vehicle to move forward and backward respectively.
![Basic DC Motor Code](https://static.wixstatic.com/media/a9d1bf_c146565a05b44135b1afbf11745cf15b~mv2.jpeg/v1/fill/w_980,h_980,al_c,q_85,usm_0.66_1.00_0.01,enc_avif,quality_auto/a9d1bf_c146565a05b44135b1afbf11745cf15b~mv2.jpeg)
The code above instructs the vehicle to move forward or backward. This is done by sending an identical signal to both DC motors causing them to rotate at the same rate.
![ZigZag Code](https://static.wixstatic.com/media/a9d1bf_a103c625ccdc46ab9bf5fc7bfab82330~mv2.jpeg/v1/fill/w_980,h_1307,al_c,q_85,usm_0.66_1.00_0.01,enc_avif,quality_auto/a9d1bf_a103c625ccdc46ab9bf5fc7bfab82330~mv2.jpeg)
The code above is a bit more complex than the rest but essentially combines aspects of turning a moving forward in small increments. By sending commands to the motors to turn in small increments and move forward you can achieve a zig-zag motion.
![Setting Up Variables](https://static.wixstatic.com/media/a9d1bf_18981c6b8cca416c838e5778b76b427a~mv2.jpg/v1/fill/w_980,h_598,al_c,q_85,usm_0.66_1.00_0.01,enc_avif,quality_auto/a9d1bf_18981c6b8cca416c838e5778b76b427a~mv2.jpg)
The code above identifies the variables in the code such as to what pin does "blank" motor corresponds. Also providing an output code to both forward and backward pins is what allows the vehicle to move forward and backward respectively.
Before I get all my materials I first want to get acclimated to the Arduino IDE and get a better understanding of the basics. After I have a rudimentary understanding of how to accomplish the bare minimum and actually construct it I will begin to implement my own innovative additions to the project !!!
1A: Familiarize self with LED's and accessory devices
Code for controlling LED with button
The code on the left can be used to control an LED with two buttons. Since the code is relatively simple I configured the LED to respond to the Joystick inputs instead of button inputs
![Controlling LED with Button.PNG](https://static.wixstatic.com/media/a9d1bf_ed9bedc4031c42548192ebbbc4d1162d~mv2.png/v1/fill/w_600,h_229,al_c,q_85,usm_0.66_1.00_0.01,enc_avif,quality_auto/Controlling%20LED%20with%20Button_PNG.png)
![Joystick Code.PNG](https://static.wixstatic.com/media/a9d1bf_eebe4fc740fb46c896c5be680c8dde86~mv2.png/v1/crop/x_0,y_31,w_1213,h_793/fill/w_503,h_329,al_c,q_85,usm_0.66_1.00_0.01,enc_avif,quality_auto/Joystick%20Code_PNG.png)
Code for reading Joystick inputs
The code here can be used in conjunction with a monitor and a single analog joystick. The joystick will then send its corresponding X and Y values to the computer and it will print the resulting values. I used the same code minus the printing feature in the DC motor control code.
LED Controlled by Joystick
![LED Controlled by Joystick Code.PNG](https://static.wixstatic.com/media/a9d1bf_77a45b01b04846d284b21e7da405f179~mv2.png/v1/crop/x_0,y_0,w_1227,h_1548/fill/w_555,h_700,al_c,q_90,usm_0.66_1.00_0.01,enc_avif,quality_auto/LED%20Controlled%20by%20Joystick%20Code_PNG.png)
I wanted to test out certain blocks of code. This is essentially how the LED indicator will function. When the analog joystick value reaches a certain point the LED will turn on.
​
I combined the Joystick code with the LED code to visualize how the LED indicator would work (similar to red lights on a reversing car).
This was fairly easy to interpret and learn because it is similar to how you would structure it using python code.
​
I also included comments on the left of the code to better understand what's happening if I were to come back to review the code eave and come back to review the code.
Compiled Code Version 1
![Compiled Code 1](https://static.wixstatic.com/media/a9d1bf_d8cb9dbd5c904749a3574ce367cd3511~mv2.png/v1/fill/w_980,h_927,al_c,q_90,usm_0.66_1.00_0.01,enc_avif,quality_auto/a9d1bf_d8cb9dbd5c904749a3574ce367cd3511~mv2.png)
This Code here is a combination of DC Motor code with turning and reversing. This set of code is controlled by an analog joystick and features an LED to indicate direction. Unfortunately, this line of code does not feature a wireless joystick receiver so the joystick must still be tethered.
![Compiled Code 2](https://static.wixstatic.com/media/a9d1bf_72cc00199bd244baad05d1a3fb891c6a~mv2.png/v1/fill/w_980,h_619,al_c,q_90,usm_0.66_1.00_0.01,enc_avif,quality_auto/a9d1bf_72cc00199bd244baad05d1a3fb891c6a~mv2.png)
![Compiled Code 1](https://static.wixstatic.com/media/a9d1bf_d8cb9dbd5c904749a3574ce367cd3511~mv2.png/v1/fill/w_980,h_927,al_c,q_90,usm_0.66_1.00_0.01,enc_avif,quality_auto/a9d1bf_d8cb9dbd5c904749a3574ce367cd3511~mv2.png)
This Code here is a combination of DC Motor code with turning and reversing. This set of code is controlled by an analog joystick and features an LED to indicate direction. Unfortunately, this line of code does not feature a wireless joystick receiver so the joystick must still be tethered.
![image7.jpeg](https://static.wixstatic.com/media/a9d1bf_6d776b5973804d3f85df9562a7e7b154~mv2.jpeg/v1/fill/w_425,h_567,al_c,q_80,usm_0.66_1.00_0.01,enc_avif,quality_auto/image7.jpeg)
Step 2: Constructing IR Remote Car v1.0
![image5.jpeg](https://static.wixstatic.com/media/a9d1bf_da061faa94124830bda1d678087db2d8~mv2.jpeg/v1/fill/w_576,h_432,al_c,q_80,usm_0.66_1.00_0.01,enc_avif,quality_auto/image5.jpeg)
Testing v1 Video
New Code
![IR CAR Code 1](https://static.wixstatic.com/media/a9d1bf_12a3701696cc4a98b0758121615885d8~mv2.png/v1/fill/w_980,h_1033,al_c,q_90,usm_0.66_1.00_0.01,enc_avif,quality_auto/a9d1bf_12a3701696cc4a98b0758121615885d8~mv2.png)
![IR CAR Code 2](https://static.wixstatic.com/media/a9d1bf_a30f586ac6e846a6808d5e20bc9cc3db~mv2.png/v1/fill/w_980,h_1008,al_c,q_90,usm_0.66_1.00_0.01,enc_avif,quality_auto/a9d1bf_a30f586ac6e846a6808d5e20bc9cc3db~mv2.png)
![IR CAR Code 1](https://static.wixstatic.com/media/a9d1bf_12a3701696cc4a98b0758121615885d8~mv2.png/v1/fill/w_980,h_1033,al_c,q_90,usm_0.66_1.00_0.01,enc_avif,quality_auto/a9d1bf_12a3701696cc4a98b0758121615885d8~mv2.png)
I decided to switch to an IR remote control scheme but I will still try other options in the future. Although the primary plate is made of aluminum I used cardboard for the top plate. Something else that was interesting is that the battery cell I was planning on using wouldn’t power the entire car so I had to get another battery. Interestingly enough I had a portable battery for a drink mixer that had a USB connection. I utilized the blue cord that comes with the Arduino and the portable battery to power the car.
Step 3A: Learning 3D printing and 3D Modeling
This was my first print, it was a pre-loaded model that came with the SD card. Although it was a nice way for me to see what the 3D printer could do, unfortunately, it was not a good way for me to gauge the efficiency of the bed level because the print had an overall small size.
![image2 (2).jpeg](https://static.wixstatic.com/media/a9d1bf_3680ac33ae7d408396d9f98c36e57a8e~mv2.jpeg/v1/crop/x_675,y_892,w_1436,h_1739/fill/w_249,h_302,al_c,q_80,usm_0.66_1.00_0.01,enc_avif,quality_auto/image2%20(2).jpeg)
![image1.jpeg](https://static.wixstatic.com/media/a9d1bf_c0229639e3b74ef487e62a15ce82a64b~mv2.jpeg/v1/fill/w_235,h_313,al_c,q_80,usm_0.66_1.00_0.01,enc_avif,quality_auto/image1.jpeg)
My next print was not only a learning experience but also the next step in my build. I found an Arduino case on Thingiverse that I used to function as an extra protective casing for my electronics. Unfortunately the first time I printed out the case I did not consider how the case had to be configured in the slicer software.
Step 3B: Printing Parts (v2.0 & v2.5)
The process of fusing the truck and upper chassis together was relatively simple. I essentially melted the pieces together with a stove and a hot knife.
![image1 (6).jpeg](https://static.wixstatic.com/media/a9d1bf_4e5cd7a982e1488482ca9ed908f8659a~mv2.jpeg/v1/fill/w_306,h_408,al_c,q_80,usm_0.66_1.00_0.01,enc_avif,quality_auto/image1%20(6).jpeg)
![image4.jpeg](https://static.wixstatic.com/media/a9d1bf_35156927f14245ac9e50a866532b10ef~mv2.jpeg/v1/fill/w_215,h_215,al_c,q_80,usm_0.66_1.00_0.01,enc_avif,quality_auto/image4.jpeg)
![Base Chasis Image.PNG](https://static.wixstatic.com/media/a9d1bf_cb63a19340a34db199b02657b9c1d3a8~mv2.png/v1/fill/w_197,h_122,al_c,q_85,usm_0.66_1.00_0.01,enc_avif,quality_auto/Base%20Chasis%20Image_PNG.png)
![image0 (11).jpeg](https://static.wixstatic.com/media/a9d1bf_320f5ec78d2c45daacae0cf85f8413f3~mv2.jpeg/v1/fill/w_189,h_142,al_c,q_80,usm_0.66_1.00_0.01,enc_avif,quality_auto/image0%20(11).jpeg)
The base plate chassis was completely designed by myself utilizing Autodesk Fusion 360.
![image9.jpeg](https://static.wixstatic.com/media/a9d1bf_2444bd42dcbe45a4a47f858249dbf480~mv2.jpeg/v1/fill/w_392,h_294,al_c,q_80,usm_0.66_1.00_0.01,enc_avif,quality_auto/image9.jpeg)
The idea for the trunk actually came to me a little while after I printed both chassis. As I realized it would be more efficient to have the battery on the outside for easy access and it would also take some load off the main chassis.
Cybertruck Version 2.0
![70B4002B-BDC9-4F2D-920D-AFFA611215B8.JPG](https://static.wixstatic.com/media/a9d1bf_680f357a4376413bbcde5cc3c62d6881~mv2.jpg/v1/crop/x_0,y_0,w_1440,h_992/fill/w_238,h_164,al_c,q_80,usm_0.66_1.00_0.01,enc_avif,quality_auto/70B4002B-BDC9-4F2D-920D-AFFA611215B8_JPG.jpg)
By May 18th, I finished 3D printing my new base and upper chassis with slightly larger dimensions to allow me to put the L298N module on the underbelly. It also has the perfect dimensions so I can put the Cybertruck case on top.
There was some slight warping but it’s virtually unnoticeable.
​
The key part about this build is the trunk. Fortunately, the slicer software I used allows for easy and quick editing of the dimension of your prints. The key was finding the perfect balance between the length and weight to ensure that the weight would not disrupt the car while in motion and that the length would allow carrying a second battery.
![image2.jpeg](https://static.wixstatic.com/media/a9d1bf_7fd4ae3f9180451b948e0ecd791cc7ad~mv2.jpeg/v1/fill/w_582,h_582,al_c,q_80,usm_0.66_1.00_0.01,enc_avif,quality_auto/image2.jpeg)
Cybertruck
Version 2.5
In this iteration, a trunk was added not only add to the cybertruck aesthetic but also to function as a way to store the additional battery.
Step 4: Version 3.0 Cybertruck
![image0 (16).jpeg](https://static.wixstatic.com/media/a9d1bf_699eddee49164cab9cdf3546596bfd33~mv2.jpeg/v1/fill/w_455,h_455,al_c,q_80,usm_0.66_1.00_0.01,enc_avif,quality_auto/image0%20(16).jpeg)
This is Version 3 of my IR car. A problem I had with v2 was that the PLA case was blocking the IR sensor which leads to sporadic control over the car. I went into Autodesk and removed the top and side portions to allow for better signal reception.
![image2 (4).jpeg](https://static.wixstatic.com/media/a9d1bf_3d51de76f5034cf0bea0c561eddde43d~mv2.jpeg/v1/fill/w_283,h_283,al_c,q_80,usm_0.66_1.00_0.01,enc_avif,quality_auto/image2%20(4).jpeg)
![image1 (9).jpeg](https://static.wixstatic.com/media/a9d1bf_684fcb10804f47ac8eb06e388061af02~mv2.jpeg/v1/fill/w_432,h_432,al_c,q_80,usm_0.66_1.00_0.01,enc_avif,quality_auto/image1%20(9).jpeg)
Final Presentation
​