Cadded a battery compartment in Autodesk Fusion
Cadded a battery compartment in Autodesk Fusion
Added a calibration mode for easy esc tweaking, and the motor now uses 250hz
I needed an input of some sort for calibrating, so I used the battery voltage pin as a temporary solution.
made a custom quadcopter model in blender and added it to the web viewer!!
Learned threejs so that I could render a cube in the browser that rotates based on the flight controller’s orientation. While doing that, I got distracted and started playing the threejs port of doom for a bit. Anyway, it works really well
Also, I suck at math
This is a problem because I’m trying to write drone firmware from scratch.
Fortunately, there are some pretty good guides out there like the one from Carbon Aeronautics. This session was mostly me trying to learn the math used to measure angles from the accelerometer and gyro.
I get some of it, such as the basic trig stuff and integrating the gyro’s readings. I don’t get the more complex stuff like the Kalman Filter because sadly, I only posses 2nd year high school math knowledge.
But mark my words, I WILL learn linear algebra and will understand it one day, maybe
also what does stardance mean by “please write this yourself, humans can read it!,” right after I pasted in an IMAGE??
I modded my radio transmitter so it works with the current flight controller
I also did some radio testing.
I also tried playing around with FreeRTOS but I’m too dumb so I gave up
Edit: Forgot to mention I created a holder for the flight controller
Made the site
I added a flexbox based blog-type UI!!!!!! ih ate css btw
Added the music player command to the bot.
It first downloads the video using yt-dlp and and then broadcasts it to a voice channel. I basically moved the search code from the previous devlog for this.
I did have some issues getting it to play music for the first time, since discord has some niche annoying feature that requires you to set the bot’s intents and i forgot to do that. Eventually, I got it working.
It came with some bugs related to file formatting, but they got fixed, and the bot should be working.
Added a feature to search for youtube videos.
Was a quick and easy api call, but Google’s documentation kinda sucks. I thought it was just me, but apparently internet people seem to agree. To quote one blog author, “Why has the YouTube API have to suck dongs?”
Anyway Google also gives you essentially no search calls a day (100/day), so to bypass that I grabbed a bunch of alts and spun up 5 or more keys which seemed like an appropriate and reasonable amount.
i did a high risk high reward type thing
I paid 6 billion dollars to JLC for the flight controller, not even being fully sure if the flight controller would work.
It arrived a week ago but I was dying at outpost so I haven’t tested until yesterday. I confirmed that the radio, imu, and motor pins work which are basically the most important parts of the FC
I created and setup the bot.
Following the discordjs guide, I made a command handler and a very bare bone slash command.
I’m finalizing the flight controller
This means that I had to do a lot of double checking and random tweaks. I didn’t record it since I wasn’t very productive and essentially wasted an entire day half doom scrolling
I did other miscellaneous things.
I fixed some DRC violations.
Most of them were caused by me needing to shrink the default trace sizes for that one sensor.
Four errors remain, which I likely won’t bother fixing since they’re just courtyard violations of the esp32s3’s antenna, which is not that integral to my project.
Routed (most of) the Flight Controller.
It may not look like much, but it was a lot of suffering.
To start off, the magnetometer I’m using has the most annoying package I’ve encountered yet. There are pins buried deep inside the center of it, and I had to adjust trace and via sizes to accommodate for them. I ended up using the absolute minimum sizes that JLCPCB has to offer.
Secondly, the radio module I’m using, which could not be moved or oriented differently, has a seriously unlucky pinout, and I ended up needing vias for almost every pin for it. Consequently, most other pins of the other sensors needed vias too, since they had to pass through or be connected to it.
I ended up with the worst PCB layout I’ve ever seen. (To be fair, I haven’t seen many PCB layouts, so it probably isn’t as bad as I make it sound)
I think it works though, I just need to spend like a day checking over it, and also route the remaining things, which are just ground planes, and power traces.
I also cost optimized my board a little by reducing the assortment of header pins, so most of them will use the same parts, reducing JLC’s unique extended component fee.
Here are some takeaways
I did more component placing. I think it’s almost ready to route, but I want to make sure I didn’t make any mistakes, namely using a forbidden pin.
I also did some component testing with the parts I already have, such as seeing if multiple motors could run at once, while the radio was transmitting, etc.
Before continuing with the PCB, I wanted to do a quick and stress free session where I tested firmware that would make the motors run.
Safe to say, it was not quick and stress free.
I initially tested the servo code on a mini mg90 servo since it was safer than testing with the esc which is powered by a big scary LiPo battery. I wasted 45 minutes with the firmware only to learn that the battery pack I used was drained. (All 4 AA batteries fell to 0.9v…)
Then I managed to get the espservo library to work, but for some reason it kept crashing the entire code whenever I tried using pinMode(). I still don’t know why that happened.
I switched to controlling the servo using the ledc api instead, which worked much better, and was quite fun to figure out. After succeeding in moving the mini servo, the ESC + motor gave me some issues. For safety purposes, ESCs have to be armed before they spin. To learn exactly how to calibrate it, I dug up a datasheet of the ESC, and finally got the ESC to spin the motor.
Overall I learned:
I started working on component placements of the PCB.
It was harder than I thought it would be.
Firstly, I had over-estimated the size of flight controllers in general, so I had less space to work with as anticipated.
Secondly, I forgot to add some decoupling capacitors in the schematic, so after doing so, I had much more components to wire.
Thirdly, the connectors were bigger than I thought, especially the ones for the radio module I plan to attach to it.
I’m still deciding some things, such as how big I want the board to be, (I’m thinking somewhere around 50x50mm, excluding the protruding antenna and usb port) and whether the PCB will be a 2 or 4 layer pcb.
I assigned some footprints
Not many interesting things happened, just mostly browsing LCSC and JLCPCB’s parts.
I also spent some effort figuring out how to import footprints from componentsearchengine
I finished the schematic. I still have some warnings to fix, but I’ve reviewed the connections, and they seem correct.
The current schematic has:
I hate working on the flight controller so I decided to work on something else instead. This is supposed to be a webpage that tests drone sensors where you can see the drone’s orientation in real time.
I’ve been dying to try out the web serial api for a while now, but I never got to it. Fortunately, I finally got to use it to receive data from the microcontroller. I managed to make the webpage receive serial data from the receiver that I built in the last devlog.