Looking for feedback on brewing shield with touchscreen

Hi Guys,

I am Elco Jacobs, the founder of BrewPi, an Arduino and Raspberry Pi based brewing temperature controller.
I have just designed a PCB for a BrewPi Spark Shield and I would like to share it with you in hope you have some valuable feedback.

Here is some background info to help you understand some of the design choices:

Background
In BrewPi, the Arduino runs all temperature control independently and the Raspberry Pi is used for data logging and providing a web interface. The main reason for this is that the Pi can crash and the Arduino cannot: the beer is always safe.

The Arduino has been a good platform for a while, but we are outgrowing the platform in ROM and RAM space needed. The Spark core seems to be the most promising platform to upgrade to, mostly due to the active community behind it.

The on board WiFi fits with our goals of having a central server and multiple embedded controllers for various parts of the brewery. One of these devices is a fermentation fridge and another we are working on is a HERMS setup where the spark has to control pumps, heating elements, motorized ball valves, and pressure volume sensors. See http://www.homebrewtalk.com/f11/automated-closed-system-herms-layout-490798/

The key aspect for this new version of BrewPi will be modularity: our software will let you set up a physical model of your brewing setup and assign sensors and actuators for model predictive control.
For this reason, I have chosen to focus on bus protocols: the shield has only 3 digital pin outputs, all other devices have to connect through OneWire or RS-485.
This lets us connect many sensors and actuators. For example, the HERMS setup will have 12 motorized valves, 2 pumps, 2 heating elements and about 8 temperature sensors. I plan to daisy chain all of them to prevent wire spaghetti.

The shield design
So here is the schematic, PCB layout and 2 board renders. It was quite a challenge to route this baby!
I changed the pin mapping continuously to try and prevent wires from crossing. The end result is pretty small (90x60mm), 2 layers, all components on one side, and display right in the middle.

So what’s on the board?

Spark core
Of course, there are headers for the spark on board. We might switch to integrating one on the board later, but for now a shield works well. The spark is near the edge, so USB can still be used when this is in a casing.

TXB0104PWR Level shifter
The outputs are all 5V logic level, so I added a 4pin TXB0104PWR level shifter. This is the 4 pin version of the TXB0108PWR on the shield shield. I actually think the shield shield would be better with the TXS0108, because it supports pull-up resistors, which are required for I2C or 1-wire. It has lower output current per pin, but I think that’s less important than supporting 1-wire and I2C. I picked the TXB014PWR, because I decided to not route I2C off-board and I have a OneWire bus master on board.

DS2482-100 OneWire bus master
I decided to include a OneWire bus master with strong pullup. This will make the shield more robust in big OneWire networks and offload the core with the precise timing requirements. It will also provide 3.3->5V level shifting for more reliability. This chip is powered by 5V, but the SDA and SCL pins of the Spark are 5V tolerant.

MAX3082E RS-485 driver
We will be developing new sensors, for example pressure based volume sensors. To make it easy to use them (plug and play), they should be automatically discovered and have a standardized protocol. In other words: their own microcontroller. RS-485 is the most used multi-drop bus protocol to talk to other devices over long distances.
I picked the MAX3082E for the reduced slew rate (less interferance), fault safety (shorted or open), and ESD protection.
There is an on board 120 ohms resistor for line termination.
I have verified with Maxim that the MAX3082E can be driven by the 3.3V pins of the spark.

Digital inputs/outputs
Just 3, because of the bus protocols. I added an LED for easy debugging. I did not add snubber diodes, as most people using mechanical relays will use prefabbed pcb modules, which have snubbers on board. These outputs are more than fine for SSRs, with 5V, 50mA drive from the level shifter. I will use pluggable terminal blocks for these.
All 3 outputs are on a PWM pin of the spark.

A7 was left, so I added a header to have just 1 analog inputs for prototyping. I would like to give the board more analog inputs, but it was either level shifting or analog input capability.

Buzzer
A self-driven (internal oscillator) buzzer for alarms. The level translator drives the buzzer at 50mA, which should be enough.

TFT module with touch screen and SD card slot
I found this TFT, which seems to offer a lot of bang for buck: 2.4", 320x240, touch screen and SD card slot. All are driven by SPI and have their on chip select pin. The touch IRQ pin is on an interrupt pin of the spark (D2).

The display is powered by 3.3V from the spark, but the backlight LED is powered from 5V, to have a bit more voltage drop over the series LED for the backlight.

The display is mounted to the bottom of the shield, but I used Samtec BSW bottom entry headers, so all components are mounted on top of the board and the board can be assembled with SMT and reflow soldering. The pins insert into these headers through holes in the board.

4x RJ12 connector block
All 4 RJ12 connectors are connected in parallel (yay bus protocols!).
On the middle 4 pins, I have OneWire, GND, 5V, 12V. This should be enough to connect DS18B20 temperature sensors, OneWire thermocouple chips, DS2408/DS2413 chips to control ball valves, pumps, heating elements and other digital inputs and outputs. These can all have an RJ11 plug, which only connects to the middle 4 pins.

The outer pins have RS-485 for talking to other devices, so if a user plans to use RS-485, he can use RJ12 cabling instead of RJ11.

Power circuit
I copied the power circuit from the spark shields. I am still in doubt whether I should add a DC-DC converter instead. This supplies only 800mA, so the power that can be drawn from the 5V line is limited. It will also generate quite a bit of heat dropping down from the 12V input.

Most power hungry pheripherals will however be powered from the 12V line, like PC fans and the ball valves.
Typing this I just saw, I need a bigger diode than the MBRA140.

Reducing costs
The BrewPi Arduino shield was expensive to manufacture. Too many parts had to be soldered by hand, partly because there were components on both sides of the board.
It also had a lot of connectors on board. Some of those would never be used. What not many people realize is that connectors are the most expensive components, they cost much more that semiconductors.
By choosing bus protocols, limiting the amount of connectors and using cheap RJ12 connectors, I tried to limit costs this time. The board also only has 19 different components.

Conclusion
So that’s my design and the argumentation behind it. Please try to shoot a hole in my reasoning, don’t be kind. I would really appreciate some honest feedback.

9 Likes

Here are 2 renders of the PCB. As a new forum user, I could only include 2 images in the opening post.

2 Likes

Great work here and tons of features packed in a small board!

I’m not a brewer but those stuff you mentioned sounds cool. :slight_smile:

You are probably on the right track too as new hardware is in the works and your BrewPi project will only become better as we progress!

Good luck :slight_smile:

1 Like

Hi @Elco

This looks very nice! It seems like you have a lot of board area so I would suggest you make a larger keep out area near the antenna for the Spark core, assuming you are using the chip antenna. I think you will be happier giving the antenna some room, particularly if think you might have long wires with signal integrity problems.

4 Likes

I was going to comment on the same as bko. Remove the ground planes on both sides of the PCB around the Spark Core antenna. Check out the Shield Shield as this is what they have done with that. I also did the same with a recent PCB design for the spark. The same applies to the relay shield.

3 Likes

Very nice @Elco! Some quick thoughts after reviewing the board and your use case:

  1. The TXB0104PWR tends to oscillate if you attach long wires between it and the device you are driving. “Long” is like greater than 3-6" in my experience. It will oscillate at 50MHz. It does this because of it’s automatic bi-directional nature. The best type of device here would be a 74HCT125 for dedicated 5V outputs. The discrete Mosfet driver type level shifter that both Adafruit and Sparkfun sell would also work, but the output is weak (a 10k pull up resistor), and it tends to be too slow to drive thing like NeoPixels (for example).

  2. The extra Analog input would benefit from a 0.01uF ceramic capacitor from A7 to GND.

  3. Comments about a 0.5" ground plane keepout around the spark core chip antenna are spot on, unless you plan on using a u.FL Core… which might be a good idea anyway.

Good luck!

4 Likes

Thanks for the feedback!

@bko and @v8dave, I should have thought about that! Silly mistake. I will reroute the PCB to give the antenna some room.

@BDub

  1. I didn’t know they tend to do this, thanks! I choose the TXB104PWR
    so the pins could be used as input as well. Using the 74HTC125 would
    make the pins output only. Discrete MOSFETS will make the outputs
    weak indeed. Perhaps the easiest solution, and most comprehensive
    for end users, would be to bring A7 out with a connector as the only
    input (analog or digital) and make the 3 other pins output only.

  2. I should not have forgotten that. I think I’ll just add a 100nF,
    because there are a few on the board allready.

  3. Yep.

1 Like

Sounds good! However the reason I mention 10nF instead of the typical 100nF is because a temperature sensor like the TMP36 can only tolerate 10nF max on it’s output. It might be interesting to just put down 10nF and an extra depopulated through-hole cap in parallel with that. Then users could add more capacitance if necessary, or have a bare minimum amount already available :wink:

1 Like

@BDub, I cannot find a high output current version of the 74HCT125 that accepts TTL inputs and has CMOS outputs.

With their 6mA output drive, I might be better off with a discrete MOSFET level translator.

Here is another idea: SN74ACT244, octal line buffer. I could group the inputs/outputs 2 by 2.
The pinout is terrible though.

@Elco, looking at the specs for the 74HCT125, each output can sink 15ma comfortably. How much current do you need?

2 Likes

@peekay123, I must have been staring myself blind on parametric component search tools, which report a lower current.

I can just add a BSS84 for the pieze buzzer and use the 74HCT125 for the 3 outputs.

1 Like

@Elco, which piezo or buzzer are you using (model #)?

I picked this one: http://www.mouser.ee/ProductDetail/Kobitone/254-EMB105-RO/?qs=sGAEpiMZZMsK322k1rNFfZnihQLykOod%2bXcNx2fdyNY%3D

Totally up for change though. Main goals are small form factor and self drive (internal oscillator).

@Elco, there are more buzzers out there than you can shake a stick at! The one you selected seems fine to use with the BSS84.

Allright, made some changes :slight_smile:

  • Made space and removed ground plane under antenna as much as I could.
  • Replaced TXB104 with 74HCT125, ACT1-3 now output only
  • Used 4th output of 74HCT125 to drive the BSS84 to drive the buzzer. The driver could be just enough without the MOSFET, but added it just to be sure. I might swap for a different buzzer with higher current rating.
  • Added a 1.5A polyfuse in the 12V line to protect against overcurrent. 1.5A is the RJ12 block rating.
  • Added 10nF on A7.
  • Swapped MBRA140 for PMEG4030, a 3A schottkey diode.
  • Had to shift everything around!
2 Likes

Looking good! Hey I just had a thought if you want to maximize your 74HCT125 output current on ACT1-3, move the status LED that are soaking up about 3mA of current to the input side. They will function the same.

And then order it before we nitpick it to death! :wink:

I did consider it @BDub, but decided against it, because it would make routing a lot uglier, as I wanted to keep the LEDs near the outputs.

But now that I look at it again, having the 3 LEDs right under the spark core might be an option.

1 Like

BTW, what is your rendering process? That’s a pretty nice view if it’s just a couple clicks :slight_smile:

Actually, no, routing the LEDs in front of the 74HCT125 is a bitch. The last pin of the spark goes to the first connector.

Drag and drop your gerbers:
mayhewlabs.com/webGerber/

1 Like

Whoa, $1.50/sq in. and 3 copies of your circuit board! Sweet :slight_smile: Have you used his service before?

That gerber viewer is rad!

2 Likes