R2D2 model
Hardware- 7 Devlogs
- 9 Total hours
A downscaled R2D2 model, which is capable of rolling, and has some flashy lights
A downscaled R2D2 model, which is capable of rolling, and has some flashy lights
Today I wrote the prototype of the code, which will control the motion of R2D2. The original version will control it wirelessly, along with the sounds and ligths, but this controls only the motors yet, via a microUSB cable. I wrote it in VSCode, and I will only copy it to Thonny (which i’ll be using for the Pico) when it is fully completed. I took the help of Gemini, to explain me how to control it (the robot, eventually) using my keyboard, and with the final debugging. I also watched Electro Nerds Academy’s youtube video in the process, which explains how to control the TB6612FNG motor driver with Arduino, and C++, I did this to make sure I understand the process. I still have a lot to learn, but slowly and surely, R2 will roll!
Today, I got the Pico!!! Immediatelly I started to load up micropython on it, and download Thonny. It was a bit tricky, because my antivirus program wouldn’t let me download it, but I disabled it temporarily, and it worked just fine. And I quickly reviewed the first few pages of my PDF book, to make sure I know my Pico physically, not just the Wokwi version. After that I wanted to try it out with the onboard LED, but it didn’t worked, so I asked Gemini. I found out that my Pico, is actually Pico W, and the onboard led is a little different. After that it worked beautifully. Then I wanted to light up an external LED, and guess what, it also didn’t work! I started troubleshooting with Gemini on my side, and I found out, that my breadboard’s ground rail is probably damaged. After rewiring to bypass it, it lighted up!
A problem occurred during the delivery if the Pico, so it got retured to the sender. We had to order it again, so until it arrives, I thought I could learn actually how to control the DC motors with it, with the help of a TB6612FNG motor driver which we will be using. I asked Gemini to explain it to me, without providing exact codes, to ensure I actually understand the code, and not just copy-pasteing. It gave me a great youtube tutorial too, from Electro Nerds Academy, which used Arduino (and therefore C++), but it helped me understand the core principles of the wiring, and the code
So today, while I was STILL waiting for the Pico, I built a reaction time based game, and a burglar alarm in Wokwi, with the help of the PDF book I’ve mentioned before. By this, I’ve learnt how to use the urandom library in Micropython, which I think will be really useful with R2D2 ‘s flashing lights, and sounds, and with the burglar alarm I’ve learnt how to connect, and use a sensor with the Pico. Putting sensors in R2D2 is a secondary, and a long-term goal, but it would be really nice. I hope that after this, I’ve learnt the basics of Micropython, so I think I’ll start focusing on our actual project, R2D2. (I don’t know when will the Pico arrive, so this is a major limiting factor)
So, today I’m still waiting for the Pico, so I’m still using Wokwi, and the PDF book, to learn, and practice. Today I’ve made a traffic light, which is working by continuously alternating red, yellow and green lights. It worked just fine, until I added a feature, so when a “pedestrian” pushes a button, a buzzer makes 10 beeps, and the light switches to red for the “cars”. This seemed to be too much for Wokwi, and it kind of crashed, so I relied on the PDF book, to verify the code, and the wiring.
Today, I was still practicing Micropython, and connecting circuits in Wokwi’s Raspberry Pi Pico simulator, with the help of the “Get Started with MicroPython on Raspberry Pi Pico” book. I’m still waiting for the delivery, so I can’t do it physically yet, but I think it’s still a great way to learn, and it even lacks the risk of frying anything. I succesfully made an LED blink, and connected a four-legged push button to the Pico. The final “project” of this session was building a circuit, so when you push the button, the LED lights up. I had a little problem with this, so I took the help of Gemini, and we figured out, that I accidentally connected the button to the Pico’s 3V3 EN pin, instead of the 3V3 pin, and I had a missing colon in the code. After fixing, it worked beautifully
Today, I started to learn micropython for the Raspberry pi Pico WH, which I will use for my team’s R2D2 model. I do not have one yet, im currently waiting for the delivery :) , but I used Wokwi’s Raspberry pi Pico simulator, and the PDF micropython tutorial book, which I found on the original Raspberry Pi website. (well, not exactly there, because it showed me error 404, but I found it on Internet Archives, it’s title is “Get Started with MicroPython on Raspberry Pi Pico”). With the help of these, I learned how to import libraries in micropython, and how to turn on the Pico’s onboard LED. I even programmed it to stay on for a certain amount of seconds. I also used VS Code to try out some basic python loops.