Fishbreath Builds a PCB

I’ve been working on a little hardware project (documented a little bit in the homebrewing thread, and more extensively here and here) to measure the progress of fermenting beer, and I’m to the point now where further work with breakout boards and jumpers seems like a false economy. For the dimensional requirements I have, a custom printed circuit board seems more likely to work in the longer run.

So, long story short, I’m far enough along now with the design that I’m getting ready to order some boards and some components. Given that I’m that most dangerous of creatures, a software engineer with a soldering iron, I’m hoping to have someone with a little more relevant experience take a look at the design before I send it off to Shenzhen. Does that fit anyone here, or does anyone know where I might go for critiques?

I have nothing to contribute, but reading this fills me with that same wonderment I’d feel if we had a Ritual, Conjurings and Spells forum.

I frequently feel that way about my own job.

I had a kit from Radio Shack that I used to create a couple of very simple circuit boards way back when. I have no help for you but please keep us informed as I find it very interesting.

I guess it’s not surprising that there’s a subreddit for PCB design and design reviews.

We went from this:

To this:

Mostly, the guys over at Reddit suggested I use smaller resistors and capacitors to make routing the traces easier, and that I put the antenna from the wifi chip off the top end of the board for better performance. That led to a fairly substantial redesign, moving the accelerometer/gyroscope chip from the top of the board pointing down to below the wifi chip pointing up.

I’m proud of the routing. Some parts of it are quite fetching.

It’s beautiful, my man. I can’t help you as I don’t have insight into proper PCB design, but I appreciate a good board and looking at that makes me happy.

That thing looks about life sized on my phone, 2.1 cm wide. What’s the I/O for it, or does it have any? Put another way, is this thing leads in/leads out or does it have a port?

It’s about as big as a USB stick, yes?

Edit: Oh wait I do see USB pins on the right side. Is that where the I/o is? But there is battery lead over there too.

On the back side of the board, there’s a USB-to-serial converter (the six-pin row on the diagram). The RX and TX lines run along the top of the board to the microcontroller at the left edge. The micro-USB port on the USB-to-serial breakout board actually faces into the center of the PCB, regrettably, although I might be able to spin it around to make plugging into it a bit easier.

All of the non-ESP-12 chips are breakout boards, so that amateurs like me can solder them together more easily. The USB port on the back, if I do manage to turn it around, should clear the Molex connector easily.

Nice job! And score a victory for reddit.

Owing to a double whammy of intellectual property reasons—namely, that the tilting hydrometer was patented in the US in 2013, and that my brewing partner is a patent attorney—we’ve had to abandon the idea of tilting.

Not to be defeated so easily, we quickly came up with an alternate plan. The classic manual hydrometer is a hollow glass cylinder, weighted at the bottom so it floats vertically, with a scale on the side indicating how dense the medium in which it’s floating is. That scale is actually measuring the buoyant force acting on the cylinder. It’s just labeled in more convenient units. It’s more or less the same thing the tilting hydrometer does: take a measurement of buoyancy and convert it to gravity, although the tilt hydrometer is measuring a second-order effect of buoyancy.

There are other ways besides floating and tilting to measure buoyancy, though, such as sinking. An object which weighs 50g and occupies 20cc of volume displaces 20ccs/grams of water. If you put it on the end of a string and put the other end of the string on a scale, then put the object in water, the scale reads 30g. Change the density of the medium, and you change the observed weight of the object.

The nice thing is, all we need to fit through the narrow opening which sparked this project in the first place is a load cell (about 50mm by 12mm by 12mm) on the end of a threaded rod, and maybe a separate temperature probe. As such, we can leave the board outside, and thus it gets significantly bigger. In part, that’s to put all the components on the same side, which makes assembly a whole lot easier.

I’d obviously defer to a patent attorney on this, but I thought that you could use patented ideas for personal use, i.e. if you’re not selling or distributing things?

Also please keep posting updates! I did a very small amount of PCB design in grad school but nothing from the ground up.

That’s what I thought, too, but apparently there isn’t a personal use exception in patent law. That, and posting source code and schematics probably counts as indirect infringement, too.

Over the last few days I’ve been learning about transistors, but I haven’t learned very much, because transistors are annoying and difficult.

They’re also useful, though. Originally, I was using one to turn off the power to the battery monitor circuit, because the temperature sensor I had was analog, and the ESP-12 only has one ADC pin for analog sensors. I switched to a digital sensor because they come in pre-packaged waterproof/stainless steel assemblies, but learned that the battery charger breakout board doesn’t like being used as a power supply in the absence of a battery. So, time to bust out the transistors!

The + and - pins from the USB serial chip now connect directly to the voltage regulator and the ground plane. Transistors of the p-channel MOSFET variety sit between the battery+ and the voltage regulator on one side, and the ground plane and the battery- on the other. P-channel transistors allow current to flow from the source to the drain when there’s little or no voltage on the gate pin, and block current flow when there is voltage on the gate pin, so the USB+ rail also connects to the transistors’ gate pins. When USB power is connected, the transistors trigger, cutting off the battery from the rest of the circuit power/ground. When USB power is disconnected, the transistors allow current to flow from the battery+ and to the battery-, and Bob’s your uncle.

At least, that’s how it’s supposed to work. I’m still pretty out of my depth here.

Turns out I was doing the battery cut-out circuit wrong in some small but crucial ways, which probably would have, in the best case, burned out a transistor, and in the worst case, burned down my house.

That’s all fixed now, though, and I’ve wrapped up the PCB design. The components for the breadboard version ought to be here soon, and I want to get the software side set up before I go any further on the circuit board.

I have obtained some extremely nerdy headwear to help with the fine soldering.

Now I need to talk myself out of buying an oscilloscope.

Nicely done. Kudos!

That’s easy–everyone knows you should make your own oscilloscope!

I have built my own variable power source, volt meter, and circuit tester ( with a transistor test socket). But I am no way ready to build my own oscilloscope. :)

There are kits which don’t take all that much assembly—just through-hole soldering. That said, they’re all down in the 100kHz to 1MHz range, and if I have to deal with digital signals, I need way more than that. I think.

So, in what may be a devastating blow to the weigh-a-torpedo method, these load cells appear to be highly sensitive to moisture, and it’s hard to correct for that. (I have some further testing to do to see if it’s a sensitivity of the sort that’s likely to cause problems, and it may turn out to be no big deal, but if not…)

If it is a problem, it’s pretty much impossible to compensate for. I do have a backup plan: just build a high-precision scale and put the whole fermentation vessel on it. A 5-gallon batch of your average beer loses about 750g to 1kg of mass over the course of a fermentation, and that’s on a mass of only about 20kg. Those aren’t terrible parameters to design a scale against.

That simplifies the design in a lot of ways, too; I don’t feel bad about requiring wall power (via USB) for that sort of setup. We’ll see if it has to happen. It might happen anyway, even if the in-carboy sensor works out, because I think it’s a fun idea.

The moisture sensitivity actually seems to be temperature sensitivity by a different name: evaporative cooling. My basement is pretty dry, so spritzing the load cell with water almost immediately starts to chill it down. The inside of a fermentation vessel ought to be a much less evaporation-friendly environment.

I went ahead and ordered the first set of PCBs today. If testing proves the weigh-a-torpedo method to have insurmountable difficulties, I can use the same board to test the high-precision scale method.

The top copper view is pretty sweet.