Hardware Documentation
This page is intended to document the MFM waterheight 4.0, a low power, low-cost, open source sensorplatform, which in this configuration can measure water distance and temperature.
Hardware version 4.0.2
Index
- 1 Index
- 2 v4.0 vs. v3.x
- 3 Electric design
- 3.1 Pinout
- 3.2 Microcontroller
- 3.2.1 Sercom
- 3.3 USB
- 3.4 LoRa module
- 3.5 Batteries
- 3.6 Power supply
- 3.7 RTC
- 3.8 IO
- 3.9 Ultrasonic sensor
- 3.10 Temperature sensor
- 4 Programming
- 5 Battery voltage sense
- 6 Measuring subsystem power consumption
- 7 Maximum operating temperatures
- 8 Further reading
v4.0 vs. v3.x
The renewed design of the version 4.0 has several enhancements compared to version 3.x.
Different LoRa module, the Mircochip RN2483;
SMD;
Different batteries, the version 4.0 will use larger batteries;
Onboard RTC;
More communication protocol ports, up to 6 configurable hardware communication ports;
USB-port programming.
Electric design
Pinout
Pinout of the ATSAMD21G18
Pin # | Pin int | Trace name |
1 | PA00 | XTAL32_IN |
2 | PA01 | XTAL32_OUT |
3 | PA02 | AIN0 |
4 | PA03 | AIN1 |
5 | GNDANA |
|
6 | VDDANA |
|
7 | PB08 | LORA_RESET |
8 | PB09 | ONEWIRE |
9 | PA04 |
|
10 | PA05 |
|
11 | PA06 | SW_STATUS_LED |
12 | PA07 |
|
13 | PA08 | JSN_TX |
14 | PA09 | JSN_RX |
15 | PA10 | BATT_SENSE |
16 | PA11 | DIO0 |
17 | VDDIO |
|
18 | GND |
|
19 | PB10 | MOSI |
20 | PB11 | SCK |
21 | PA12 | MISO |
22 | PA13 | DIO1 |
23 | PA14 | XTAL_IN |
24 | PA15 | XTAL_OUT |
25 | PA16 |
|
26 | PA17 | LORA_ON |
27 | PA18 | LORA_RX |
28 | PA19 | LORA_TX |
29 | PA20 | JSN_ISO_5V_ON |
30 | PA21 | RTC_INT |
31 | PA22 | SDA |
32 | PA23 | SCL |
33 | PA24 | USB_D- |
34 | PA25 | USB_D+ |
35 | GND |
|
36 | VDDIO |
|
37 | PB22 | EDBG_TX |
38 | PB23 | EDBG_RX |
39 | PA27 | JSN_ISO_3V_ON |
40 | RESET | RESET |
41 | PA28 | RTC_VCC |
42 | GND |
|
43 | VDDCORE |
|
44 | VDDIN |
|
45 | PA30 | SWCLK |
46 | PA31 | SWDIO |
47 | PB02 |
|
48 | PB03 |
|
Microcontroller
The microcontroller selected for this board is different than the normally used atmegas in the other builds. The reason for a new microcontroller is a lower sleep power consumption, more IO and an USB program port.
Sercom
The ATSAMD21G18 has 6 configurable serial communication modules. The table below shows how they are configured.
Sercom | Pad | Component | Protocol | IO name | Pin |
0 | 0 |
Serial1 |
UART |
|
|
1 |
|
| |||
2 | RX | PA11 | |||
3 | TX | PA10 | |||
1 | 0 |
LoRa (RN2483) |
UART |
|
|
1 |
|
| |||
2 | TX | PA18 | |||
3 | RX | PA19 | |||
2 | 0 |
JSN |
UART | TX | PA08 (alt) |
1 | RX | PA09 (alt) | |||
2 |
|
| |||
3 |
|
| |||
3 | 0 |
RTC |
I2C | SDA | PA22 |
1 | SCL | PA23 | |||
2 |
|
| |||
3 |
|
| |||
4 | 0 |
|
SPI | MISO | PA12 |
1 |
|
| |||
2 | MOSI | PB10 | |||
3 | SCK | PB11 | |||
5 | 0 |
|
EDBG* |
|
|
1 |
|
| |||
2 | TX | PB22 | |||
3 | RX | PB23 |
* when researching the EDBG topic it seems that for supporting EDBG an extra uC is required. nevertheless the edbg pins are broken out for prototyping purposes.
USB
In previous models the way of programming and communicating is a bit hard for users who are not that familiar with electronics. The usb cable is known to almost everybody these days, and the ATSAMD21G18 supports the USB protocol. This is also a reason to switch to this microcontroller.
LoRa module
The v4.0 uses a defferent LoRa module compared to the v3.x. In the version 3.x the RFM95W is used. In this version the Microchip RN2483 is used, which is LoRa Certified. This certification is required to get access to the KPN national LoRa network in the Netherlands.
Batteries
In version 4.0 different batteries can be used, because there is more space free on the PCB. The selected batteries in the new design are Tadiran SL-2870/P and are of of 'C' size. These have a higher capacity at 8.5Ah vs. 2.6 Ah of the SAFT-LS14500. The battery configuration stays the same, still 2 cells in series. The Tadiran batteries extend battery life to an approximate 10 years, while costing more at €12,- each at Farnell. Note that delivery time is extended, because Farnell does not hold any stock of these cells. MOQ is 30 pcs and multiplies of 30 pcs.
There is a option to chose for the SL-2770/P (same size and capacity). This cell has a higher discharge rate but has fewer battery capacity when discharging at a low rate. This product will be most of the time in powersaving mode, thus will not discharge very fast. this is why the SL-2870/P is selected for this product.
Link to datasheet:
Battery options:
Power supply
The power supply consists of two Microchip MIC5201, for 3.3V and 5.0V output. 5V is only required for the ultrasonic distance sensor, the JSN-SR04T 2.0, because this sensor performs better on 5V compared to 3.3V.
The rest of the board is on the 3.3V line.
RTC
The RTC is used to exactly time the wakeup time of the MFM. Now the measurements are not exactly on the measurement interval time, because the uC crystals are not accurate enough for that purpose.
In the v4.0 the DS3231 RTC chip is used. There is also a 3.3V coincell (CR2032) battery on the bottom of the PCB for time keeping.
IO
The microcontroller itself has a few IO ports broken out.
IO | Pin | Digital pin | PCB refference | Comments |
---|---|---|---|---|
LED MCU | PA06 | 8 | D5 | PWM |
AIN0 | PA2 | 14 / A0 | J11 |
|
AIN1 | PA3 | 42 | J12 | AREF |
BATT_SENSE | PA10 | 1 | - |
|
DIO0 | PA16 | 11 | J5 | PWM |
DIO1 | PB09 | 16 / A2 | J7 |
|
Onewire | PB02 | 19 / A5 | J9, J10 | Used for DS18B20 |
Ultrasonic sensor
The ultrasonic distance sensor is still the same as used in previous models. the only difference being that the design choice now is to directly solder the daughter board of the sensor to the main MFM PCB. JSN is in mode 3 (see datasheet for modes).
See also JSN-SR04T
See also temperature correction
Temperature sensor
The temperature sensor is still the same as used in previous models. This can be used to correct for the speed of sound and make the distance measurement more accurate.
See also DS18B20
Programming
The main programming port of the board is through the SWD port (J1). Besides this there is an USB port onboard which can be used to program the board as well for a more user-friendly method.
Further instructions on how to program the board will follow.
Battery voltage sense
On PA10 the battery voltage is connected through a voltage divider to lower to a safe voltage for the SAMD21.
To calculate the battery voltage:
R1 = 10 kΩ
R2 = 16 kΩ
ADC_READING = raw value read from the ADC;
adc_volt = ADC_READING * 3.3 / 4096. <4096 when using 12bit reading>
Battery_voltage = adc_volt * (R1 + R2) / R1;
Measuring subsystem power consumption
There are three shunt resistors of 270mΩ for measuring subsystem power consumption.
Location | Subsystem |
---|---|
J13 | SAMD21 |
J14 | RN2483 |
J15 | JSN-SR04t |
Maximum operating temperatures
Main component | Component | Minimum °C | Maximum °C | Note |
---|---|---|---|---|
LoRa module | RN2483 | -40 | +85 |
|
Battery | SL-2770, SL-2870 | -55 | +85 |
|
| SAFT LS26500 | -60 | +85 |
|
| EVE ER26500 | -60 | +85 |
|
Microcontroller | SAMD21G18 | -40 | +125 |
|
Distance sensor | JSN-SR04t-2.0 | -20 | +70 |
|
Temperature sensor | DS18B20 | -55 | +125 |
|
RTC | DS3231 | -40 | +85 |
|
Optocoupler | ISO7421DR | -40 | +125 |
|
Voltage regulator | MIC5201 | -40 | +125 |
|
Crystal | 8MHz | -20 | +70 |
|
| 32 kHz | -20 | +70 |
|
Resistor |
| -50 | +155 |
|
Capacitor | Ceramic | -55 | +125 |
|
| Electrolytic | -40 | +105 |
|
USB ESD | PRTR5V0U2X,215 | -40 | +85 |
|
Further reading
For the schematic, gerber files, BOM, source code check out the github of the Multiflexmeter project.
Source code: https://github.com/Multiflexmeter/mfm-v4
Hardware files: https://github.com/Multiflexmeter/mfm-hardware
Multiflexmeter website: https://www.multiflexmeter.nl/