Sunday, January 10, 2021

Large Rocket Avionics Board for attitude control, estimation, telemetry, etc.

Alongside my own vehicle, I have been helping a friend out with his liquid fueled rocket project. It uses an LR101 lox-RP1 engine running at 1000lbf roughly. It is pressure fed via some helium tanks. So far the vehicle is passive, but he was interested in adding some electronics to control attitude closer to the ground, at lower velocities, and when the ultimate trajectory has the highest sensitivity to winds and perturbing forces/torques. This will be done with four cold gas jet thrusters at the top of the vehicle. They're purely for making the vehicle upright, so any lateral translational motion is fine with us.

So I designed a little STM32 flight computer board that includes a GPS unit, radio, two IMUs and an interface to control some valves. The valve control board is a relay board. I know someone out there is going to whine about this aw but never put relays into rockets, they're going to short under vibration. Well I'm not sure what to tell you. I have smashed the shit out of this thing with hammers, tables, etc and cannot get them to click over (verifying with actual solenoid valves and their power supply). Am I doing something wrong? I can easily swap with MOSFETs, but I need a an argument that beats my hammer.

I designed this board in April 2020 (almost a year ago now) and have not gotten a chance to fix up the code for the STM32. I was launching satellites in my day job. But now that they're in space, I guess I can have some free time, right?

This is what the board looked like in Eagle after all the placement and routing. The posts on the corner are for standoffs that will mount to the relay board. The large component on the right is an Aceinna IMU. The board can control up to eight valves / relay driven devices and is powered off of one supply, being bucked down to the right logic levels for chip and accessories. The 8 molex locking power connectors on the top go out to the valves / load them selves. The vias you see below go down to the relay switch board. 


I had JLCPCB fab them, because they are super affordable and fast. So far they've been of excellent quality.

Checking out the new chinese microscope..

First power up. I flashed a simple LED blink script to make sure the STM got flashed. I am using the breakoff portion of a Nucleo board to program the chip vis SWD interface. I should write a blog about that one too.


I had a slight issue with a 5V trace to the relay board.. can't win them all. So far looks good.



Here is me forcing a valve on. I have since written the IO expander (MCP23017) code to do all this for me.


Saturday, November 7, 2020

Homemade Electric Longboard V1

 Last year I threw together a custom 4kW electric longboard using some KEDA outrunner motors and Turnigy ESCs. I wrote my own controlled with an arduino nano, a couple bluetooth transceivers, and a flexible resistor. It worked OK, mostly because the ESCs were crappy and bluetooth dropped out despite me upping the output power to the maximum.

At first with the single motor mounted it looked like this:



Here is a video of the controller sorta working. ESC issues in the first half.


Here is a video of the flexistor working:



Sunday, August 9, 2020

Saturday, August 8, 2020

Making a converter for the Apple Macintosh M0110a Keyboard from Hasu's TMK Firmware and an Arduino Pro Micro

Oof haven't posted in awhile. And yet another silly keyboard project. Work has been absurdly busy lately, and really sucking all of my mental (and sometimes emotional) bandwidth. Hopefully I can get back on track with fun projects again soon. It's felt more of a chore lately, which scares me. It's normally such a relaxing thing to be creating and creative.

The Apple Macintosh M0110a keyboard is a classic beauty with Alps SKCC white linear switches. These have a larger required depress force than the Alks SKCC green switches. So far I have noticed they are a little less smooth, but perhaps that is keyboard specific (mine did have some cruft that I unenthusiastically purged for an hour).


I have chosen to use the Arduino Pro Micro which is based off of the ATMega32u4 because they are hella cheap.

You will want to use the following diagram
Jack fig
This is the pinout with respect to the socket on the back of the keyboard case. Buy one of the 4P4C jacks, and strip the wires. Then, with everything plugged in, confirm continuity to make sure you have the right signals. The clock line should hook up to PD1 and data should hook up to PD0. These are the IO ports on the Atmega microcontroller. On the board I linked above, these are pins 2 and 3 respectively (the numbers shown on the silk screen). Then because the wires are long, I have wired up two pull-up resistors from those pins to 5V as well.

Use this command to find the serial port: ls /dev/tty*
Tty comes form the word 'Teletype.' This command basically shows the available terminals, or serial ports, or other ports from my understanding. You can plug and unplug the microcontroller to see which port it belongs to

Clone the git repository, and change directory to the M0110a directory. You can flash the device with this command:

avrdude -p atmega32u4 -P /dev/tty.usbmodem14201 -c avr109 -U flash:w:m0110_usb_rev1.hex


This will load the currently built firmware to the device. If you want to edit and rebuild then use these make commands with the provided make file:
$ make -f Makefile.rev2 clean
$ make -f Makefile.rev2 [KEYMAP={intl|spacefn}]
Also, the TMK firmware generator linked above will generate these files as well for you. You can then edit the keymap with the web interface and use the hex file that generates (a lot easier!).

If you want to re-load firmware, then (with the arduino powered on) ground the reset pin twice until it shows up in ls TTY. This will only appear temporary, as the device will put itself into bootload mode. Make sure to flash quickly :)

Here's what the keyboard looks like after I cleaned it up a fair amount.
During the cleaning process.. you can see the Alps SKCC switches:
The designers left a little window for the intel chipset running this thing. Date code 1980! 
Here it is sitting next to my IBM Pingmaster 4704 terminal keyboard:























Saturday, May 25, 2019

Pressure Regulators and Other Fluidsy things

So close friends know that I am working on a major rocket project right now.
It involves pressurants, solenoids, regulators, check valves, diffusers, tanks, COPVs, and so many damn more things that *aren't* electronics or guidance algorithms.
So I am learning a lot.

Things to look for in selecting regulators:

  • Inlet maximum pressure: this is the most obvious parameter. You need to select a regulator that will work with the system you are designing. So if it is hooked directly to a helium K-bottle, you're probably dealing with 3000+psi ratings here.
  • Outlet maximum pressure: this is another gimme. If you need to press a tank to 400psi, don't find a regulator that varies to 10psi output.
These two are hard enough to spec out for high pressure rocket systems. Then on top of that you have:
  • C_v Flow Coefficient: this one is super important and is probably the most overlooked thing in my experience. Your device must be able to flow a lot of fluid to keep up with the dynamics of the system. If the effective orifice size is small, then it will not have a high mass flow rate. 
It is defined as such:  $C_v = Q \sqrt{\frac{SG}{\Delta P}}$.  You can think of Q as your $\dot{m}$. SG is your specific gravity, which is normally unity (1 for water) on data sheets (I think). And $\Delta P$ is the pressure drop across the system. So basically the higher this coefficient, the higher the flow rate, and the lower the pressure drop.

This equation is meant for incompressible fluids, and the gas equation is more complicated. Swagelok has some good info here: https://www.swagelok.com/downloads/webcatalogs/EN/MS-06-84.PDF

The flow coefficient is important for all fluid devices that constrict flow. So just be careful when you're attempting to procure random devices on eBay. Finding stuff for reasonable prices is hard, so I always watch out for these brands:
  • Marotta
  • Aqua Environment
  • Tescom
  • Swagelok
YOU CAN get away with low flow regulators if you attach their output to the membrane of a dome loaded reducing regulator. This seems like the usual way to do things, rather then flow directly from a single hand-turn regulator. Grove Mity Mites were apparently the way to go back in the day. There is a new company that makes them with the same design you might want to watch out for.