Skip to the content
4 layers85 × 56 mmDwc hat, the printed circuit board in 3D

Raspberry Pi Monitor for Deep-Water-Cultures (DWC)

Size
85 × 56 mm
Copper layers
4
Thickness
1.6 mm
Parts
100
Nets
94
Pads
336
Tracks, vias
629, 112
Pours
9
Routed
Yes
KiCad
KiCad 5 (file 20171130)
Created
29 Oct 2021
Updated
10 Nov 2021

Overview

Dwc hat is an open-source printed circuit board by dwcguru1, from the dwcguru1/dwc-hat repository on GitHub, published under the MIT licence. It is a 4-layer board of 85 × 56 mm with 100 parts on 94 nets, routed with 629 tracks and 112 vias.

It is built around the ATTINY84A-SSF, MCP3221A5-E and MPX5010DP, with the OPA4340UA, PCA9515D and ADUM1251ARZ among its other parts. Its parts include 40 capacitors, 26 resistors, 14 ICs, 6 connectors and 1 diode. It belongs with the AVR (ATmega, ATtiny) boards of this library.

Main components

8

README

README.md

Rasperry Pi - DWC HAT

DWC-Hat

Picture above shows V3.0 - New version has some changes (e.g. pinheaders for I2C and 1-wire):

DWC-Hat V3.1

The DWC Hat does following:

  • PH measurement (DWC)
  • EC measurement (DWC)
  • Temperature measurement and correction (DWC)
  • Pressure* measurement for water level monitoring (DWC)
  • Temperature and humidity measurement of air

*: Everything except the pressure sensing works as expected. It works electrically, but there would be needed a much more sophisticated temperature compensation. To sum it up: It never worked well.

Raspberry prerequisites

Use raspi-config to enable I2C and 1-Wire.

There is a special quirk needed for getting the I2C working properly (because the Pi can't do clock-stretching):

In /boot/config.txt:

text
# Uncomment some or all of these to enable the optional hardware interfaces
dtparam=i2c_baudrate=10000

It hurts a bit to reduce the I2C rate to 10kHz - but it doesn't really matter :shrug:

Also, the 1-wire pin needs to be configured:

text
# select 1-wire pin
dtoverlay=w1-gpio,gpiopin=4,pullup=on

I2C and 1-wire Devices

There are four I2C and one 1-wire device.

I2C

text
i2cdetect -y 1:

     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- -- 
10: 10 -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: 40 -- -- -- -- -- -- -- -- -- -- -- -- 4d -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- -- -- 6a -- -- -- -- -- 
70: -- -- -- -- -- -- -- -- 

0x10: EC measurement (fixed by AVR firmware) 0x40: SI7021 temperature and humidity sensor 0x4d: MPX2050DP pressure sensor (ADC MCP3221) 0x6a: PH measurement (ADC MCP3421)

The addresses can differ (e.g. the ADC used in the PH measurement could be either of 0x68 to 0x6f).

Please check the datasheets of the parts mentioned above and/or i2cdetect for the address of your part.

The values are inserted into the config.ini:

text
[i2c]
# i2c address of EC measuring (always 0x10)
i2c_ec = 0x10

# i2c address of PH measuring
i2c_ph = 0x6a

# i2c address of MPX2050DP
i2c_pressure = 0x4d

# i2c address of SI7021
i2c_ht = 0x40

1-Wire

After connecting the 1-wire sensor, there should appear a new device at /sys/bus/w1/devices/.

Add the name to the config.ini:

text
[1wire]
ds18b20 = "28-0120625ed8f9"

AVR firmware

The EC-measuring part uses an AVR. Before doing measurements, it needs to be flashed with the firmware.

The ISP connector is 2x10 with 1.27mm pitch. The pinout is compatible to the USBASP.

Also the Makefile expects the USBASP as programmer.

For compilation, you'll need:

text
sudo apt install gcc-avr avrdude avr-libc

After that, first initialize the AVR-flags once with:

text
make fuse

Afterwards you can compile and flash the AVR with:

text
make
make flash

Now, it should be ready to go :slight_smile:

Calibration

There are two parts that need calibration. (See usage how to get the raw-values).

PH calibration

PH calibration is done by setting up two reference solutions with PH of 4.01 and 6.86.

After measuring the raw-values, insert them into the config.ini:

text
[ph]
# measured PH (raw values)
PH_401 =  13010.0
PH_686 =  2400.0

EC calibration

For calibrating the EC part, two resistors are needed.

They are simply connected to the BNC jack for the EC probe (without the probe) and the raw-values measured by the EC measuring circuit is used for calculating the EC.

The resistors are 390R and 1k.

The values have to be inserted into the config.ini:

text
[ec]
# measured EC (raw values)
EC_ADC_390R = 439.0
EC_ADC_1K = 208.0

Usage

By default, the python code does a single measurement and transmitts the date to InfluxDB.

To run it in a loop simply start it in a screen session with:

text
 while ((1)); do python3 read.py | tee -a measurements.log ; sleep 1; done

time=1635402997671, ec_raw=243.3764705882353, ec=1345.546146, ph_raw=6772, ph=5.685617, temp=20.875000, pressure_raw=122.5625, pressure_comp=44.20985378262856, humidity=68.68032836914062, airtemp=22.873859863281247
...

Grafana and InfluxDB

Follow any tutorial for installing InfluxDB and Grafana.

Default Database, User, Password is in the config.ini.

Make sure to configure the timezone right on the Raspi.

TODO

There are some things I would like to improve:

  • STM32 (M4) for EC measurement. Use internal DAC for DDS sine generation and FIR band pass. This would reduce the parts needed by a lot. Also would improve resolution (12Bit ADC instead of 10Bit ADC).
  • Better pt1000 based temperature sensor for DWC. DS18B20 digitizes too coarse what affects temperature compensation of EC negatively.
  • Replace the pressure sensing with something else better working. E.g. capacitive sensing with conductive strips glued on the outside of the DWC bin or something else ...

Disclaimer

Use everything on your own risk!

The project is at it is and if I don't need something else, I won't touch it ever again.

Feel free to do with it whatever you like :slight_smile:

Parts

100
QtyValueFootprintReferences
21100nCapacitor_SMD:C_0805_2012MetricC1, C10, C11, C12, C15, C16, C17, C18, C20, C21, C23, C28, C30, C31, C34, C35 +5
71kResistor_SMD:R_0805_2012MetricR1, R7, R8, R9, R10, R21, R23
71µCapacitor_SMD:C_0805_2012MetricC3, C9, C14, C26, C27, C37, C40
62k2Resistor_SMD:R_0805_2012MetricR2, R3, R12, R13, R24, R25
510µCapacitor_SMD:C_1206_3216MetricC2, C6, C13, C29, C33
4100kResistor_SMD:R_0805_2012MetricR4, R5, R6, R16
4TestPointTestPoint:TestPoint_Pad_1.5x1.5mmTP1, TP2, TP3, TP4
34.7kResistor_SMD:R_0805_2012MetricR18, R19, R26
20509myfootprints:Converter_DCDC_SMDU4, U8
2100n/25VCapacitor_SMD:C_0805_2012MetricC19, C32
210kResistor_SMD:R_0805_2012MetricR20, R22
247nCapacitor_SMD:C_0805_2012MetricC7, C22
2ADUM1251Package_SO:SOIC-8_3.9x4.9mm_P1.27mmU2, U10
2BNCmyfootprints:BNC_UG_1094W1P1, P4
2L78L05_SO8Package_SO:SOIC-8_3.9x4.9mm_P1.27mmU3, U5
2Net-Tie_2NetTie:NetTie-2_SMD_Pad0.5mmNT1, NT2
120kResistor_SMD:R_0805_2012MetricR15
122nCapacitor_SMD:C_0805_2012MetricC24
13.3kResistor_SMD:R_0805_2012MetricR11
133nCapacitor_SMD:C_0805_2012MetricC25
1470pCapacitor_SMD:C_0805_2012MetricC39
15.1kResistor_SMD:R_0805_2012MetricR14
18.2kResistor_SMD:R_0805_2012MetricR17
18MHzOscillator:Oscillator_SMD_EuroQuartz_XO32-4Pin_3.2x2.5mmX1
1ATTINY84A-SSPackage_SO:SO-14_3.9x8.65mm_P1.27mmIC3
1BAT54T1GDiodes_SMD:SOD-123D1
1Conn_01x03Connector_PinHeader_2.54mm:PinHeader_1x03_P2.54mm_VerticalJ2
1Conn_01x04Connector_PinHeader_2.54mm:PinHeader_1x04_P2.54mm_VerticalJ4
1Conn_02x05_Odd_Evenmyfootprints:PinHeader_IDC_2x05_P1.27mm_Vertical_SMDJ3
1Jumper_3_OpenJumper:SolderJumper-3_P1.3mm_Open_RoundedPad1.0x1.5mmJP2
1Jumper_NO_SmallJumper:SolderJumper-2_P1.3mm_Open_RoundedPad1.0x1.5mmJP1
1LMP91200Package_SO:TSSOP-16_4.4x5mm_P0.65mmU6
1MCP1541-TTPackage_TO_SOT_SMD:SOT-23U13
1MCP3221Package_TO_SOT_SMD:SOT-23-5U11
1MCP3421Package_TO_SOT_SMD:SOT-23-6U1
1MPX5010DPmyfootprints:MPX5010DPU9
1OPA4340Package_SO:SO-14_3.9x8.65mm_P1.27mmU7
1PCA9515Package_SO:SO-8_3.9x4.9mm_P1.27mmU12
1Raspberry Pi GPIOConnector_PinSocket_2.54mm:PinSocket_2x20_P2.54mm_VerticalJ1

The 96 most common of 100 parts.

Similar boards

  • 2 layers66.9 × 100 mmChairbot, the printed circuit board in 3D

    Chairbot

    bullestock/chairbot

    34 parts
  • 2 layers50 × 35 mmSoil pH AFE, the printed circuit board in 3D

    Soil pH AFE

    xmyoot/guarded-ph-acquisition-module

    Guarded pH analog front end: KiCad design, fabrication files, ESP32-S3 bring-up firmware and engineering review. Unbuilt prototype.

    44 parts
  • 4 layers42 × 85 mmDevice, the printed circuit board in 3D

    Device

    jayis1/hardware-design-lab

    Full-cycle hardware device designs — each device in its own subfolder with architecture, schematics, PCB layout, and software stack

    26 parts
  • 2 layers85.7 × 137.2 mmPIDDEF, the printed circuit board in 3D

    PIDDEF

    SNolasco86/ProjectosKiCad

    Proyectos PCBen software KiCad

    95 parts
  • 2 layers96.5 × 66 mmBumperDuino, the printed circuit board in 3D

    BumperDuino

    Ardumower/ardumower

    Develop an open source robotic lawn mower (HW+SW reference platform)

    66 parts282
  • 2 layers85 × 56.5 mmAIOR, the printed circuit board in 3D

    AIOR

    GBert/misc

    miscellaneous stuff / unsorted

    156 parts99
  • 2 layersPlaca Principal, the printed circuit board in 3D

    Placa Principal

    ciaa/Ponchos

    El poncho consta de elemento digitales y analógicos tales como: potenciómetro, buzzer, UART/RS-232, LCD 16x2, teclado matricial 4x3, y pinout para comunicaciones varias y pines de propósito general.

    40 parts15
  • 2 layers100 × 60 mmHVPowerModule, the printed circuit board in 3D

    HVPowerModule

    EPFLXplore/Power_HW

    KiCad design files for the power boards of the Xplore rover.

    105 parts7

Questions

How big is the Dwc hat PCB?

It measures 85 × 56 mm and has 4 copper layers, 1.6 mm thick.

What parts does the Dwc hat use?

100 parts, built around the ATTINY84A-SSF, MCP3221A5-E, MPX5010DP and OPA4340UA. The full list of its parts is on this page, with links to each part's symbol and footprint where PCBKit's library has them.

Where can I download the Dwc hat KiCad files?

From the dwcguru1/dwc-hat repository on GitHub, at the commit this page was made from: the board is kicad/dwc-hat.kicad_pcb. PCBKit opens the board in the browser, with nothing to install.

Can I use the Dwc hat design in my own project?

Its repository publishes it under the MIT licence: you may reuse it on that licence's terms (keep the author's notice, and for a copyleft licence share your changes alike).