A simple thermometer (DS18B20 on 1-Wire) and a display (SSD1306 on SPI) controlled by Arduino.
- DS18B20 Programmable Resolution 1-Wire Digital Thermometer
- SSD1306 Display - 0.96inch OLED (B) - connected to 4-wire SPI (default case)
Install required libraries.
In Arduino IDE (2.3.1) | Sketch | Include Library | Manage Libraries...
For DS18B20 thermometer:
- DallasTemperature 3.9.0 - https://github.com/milesburton/Arduino-Temperature-Control-Library
- OneWire 2.3.7 - https://github.com/PaulStoffregen/OneWire
For SSD1306 display:
Arduino UNO R3 has one Serial Peripheral Interface (SPI) controller with predefined pins. In this case CIPO (D12) is not used.
Arduino Pin | Name | Other common names | Description |
---|---|---|---|
D10 | SS | CS, nCS, CSB, CSN, nSS, STE, SYNC | Chip Select |
D11 | COPI | MOSI, SIMO, SDO, DO, DOUT, SO, MTSR | Master out, slave in |
D12 | CIPO | MISO, SOMI, SDI, DI, DIN, SI, MRST | Master in, slave out |
D13 | SCK | SCLK, CLK | Serial Clock |
WaveShare 0.96inch (SSD1306) configured in 4-wire mode.
OLED Pin - signatures on the device | Description in 4-wire mode | Connected with Arduino Pin |
---|---|---|
VCC | +3.3V/+5V Power input | +5V |
GND | Ground | GND |
NC | - | Not used |
DIN | COPI (MOSI - Master out, slave in) | D11 |
CLK | SCK (SCLK - Clock input) | D13 |
CS | CS (Chip select, low active) | D10 |
D/C | Command signal, low level for command, high level for data | D7 |
RES | Reset signal, low active | D8 |
With 4.7 kΩ resistor between DQ and +5V.
Digital Thermometer Pin | Description | Connected with Arduino Pin |
---|---|---|
GND | Ground | GND |
DQ | Data Input/Output. Open-drain 1-Wire interface pin | D2 |
VDD | Supply Voltage +3.0V/+5.5V | +5V |