sketchbook
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions | Variables
OWH_DS2433_EEPROM_LCD_Sensors.ino File Reference

Code that emulates a 1wire LCD/OLED Display (DS2433 4096 bits EEPROM) More...

#include "OneWireHub.h"
#include "DS2433.h"
#include "DS18B20.h"
#include <Wire.h>
#include <SeeedGrayOLED.h>
#include <avr/wdt.h>
#include <EEPROM.h>

Macros

#define FREQ_BLINK_OK   2000
 
#define FREQ_BLINK_ERR   4000
 

Functions

unsigned long RAM_lRebootCount0 __attribute__ ((section(".noinit")))
 
bool blinking (void)
 
void setup ()
 
void loop ()
 
long readVcc ()
 
double GetTemp (void)
 

Variables

constexpr uint8_t pin_onewire { 8 }
 
constexpr uint8_t pin_led { 13 }
 
constexpr uint8_t pin_button { 2 }
 
uint8_t mem_read [16]
 
uint8_t display_mode = 0
 
uint8_t mem_buffer [144]
 
unsigned long EEPROM_lPowerCount0
 
unsigned long EEPROM_lPowerCount1
 
unsigned long time_last_update
 
auto hub = OneWireHub(pin_onewire)
 
auto ds2433 = DS2433(DS2433::family_code, 0x00, 0x00, 0x33, 0x24, 0xDA, 0x00)
 
auto ds18b0 = DS18B20(0x28, 0x00, 0x00, 0x33, 0x24, 0xDA, 0x00)
 
auto ds18b1 = DS18B20(0x28, 0x01, 0x00, 0x33, 0x24, 0xDA, 0x00)
 

Detailed Description

Code that emulates a 1wire LCD/OLED Display (DS2433 4096 bits EEPROM)

Author
drtrigon
Date
2018-06-21
Version
1.1
1.0
  • add supply voltage and chip temperature sensors
  • first version providing all basic features
See Also
http://www.seeedstudio.com/wiki/Grove_-_OLED_Display_1.12%22
http://www.seeedstudio.com/wiki/File:Stem-diagram-sign.jpg
http://www.instructables.com/id/Arduino-1-wire-Display-144-Chars/
* OneWireHub library compilation for v2.2.0:
*   Needs for compilation Arduino IDE version >= 1.8.3 due to used syntax.
* OneWireHub library settings for v2.2.0:
*   In order to make OneWireHub library v2.2.0 work properly with my 1wire network
*   (Raspberry Pi Server with iButton LinkHub-E) I need to adopt
*     'libraries/OneWireHub/OneWireHub_config.h':
*       constexpr timeOW_t ONEWIRE_TIME_MSG_HIGH_TIMEOUT     = { 150000_us };
*     this is 10x the default value (may be smaller works too).
*     @see https://github.com/orgua/OneWireHub/issues/43
*   Optionally we can also change
*     'libraries/OneWireHub/OneWireHub_config.h':
*       #define HUB_SLAVE_LIMIT     8
*     as we need only 3 slots and the lower the value the faster are responses.
*   These settings might cause issues with other sketches - be aware of that.
*
* Pinout:
*   OLED (Grove Shield I2C/Wire):
*     1: GND black     -> Arduino GND
*     2: VCC red       -> Arduino 5V
*     3: SDA white     -> Arduino Pin A4
*     4: SCL yellow    -> Arduino Pin A5
*   Status LED:
*        STATUS LED    -> Arduino Pin D13
*                      -> Arduino GND via 4.7k resistor eg.
*   Control Buttons or Switch:
*        RESET BTN     -> Arduino Pin RST
*                      -> Arduino GND
*        LCD MODE BTN  -> Arduino Pin D2 (internal pullup enabled)
*                      -> Arduino GND
*   1wire data bus (MicroLAN):
*        1WIRE DATA    -> Arduino Pin D8
*
* Test on Raspberry Pi Server using OWFS (owshell):
*   $ /opt/owfs/bin/owwrite 2D.00003124DA00/memory 'hello world!'
*   $ /opt/owfs/bin/owget 2D.00003124DA00/memory
*
* Tested with:
*   - 1wire LCD/OLED Display:
*     LinkHubE-Master, atmega328@16MHz (Arduino Uno) as Slave
*   - OneWire HubDS2433 4096 bits EEPROM:
*     DS9490R-Master, atmega328@16MHz and teensy3.2@96MHz as Slave
*
* Thanks to:
* orgua - OneWireHub OneWire slave device emulator
*         @see https://github.com/orgua/OneWireHub
* 

Macro Definition Documentation

#define FREQ_BLINK_ERR   4000
#define FREQ_BLINK_OK   2000

Function Documentation

unsigned long RAM_lRebootCount0 __attribute__ ( (section(".noinit"))  )
bool blinking ( void  )

OneWireHub OneWire slave status update function.

Parameters
void
Returns
Integer indicating whether status updated with 1
double GetTemp ( void  )

Internal Temperature Sensor for ATmega328 types.

Parameters
void
See Also
loop()
https://playground.arduino.cc/Main/InternalTemperatureSensor
Returns
The chip temperature in [°C]
void loop ( void  )

Arduino IDE: put your main code here, to run repeatedly.

long readVcc ( )

Accessing the secret voltmeter on the Arduino 168 or 328.

See Also
loop()
http://code.google.com/p/tinkerit/wiki/SecretVoltmeter
Returns
The supply voltage in [mV]
void setup ( void  )

Arduino IDE: put your setup code here, to run once.

Variable Documentation

uint8_t display_mode = 0
auto ds18b0 = DS18B20(0x28, 0x00, 0x00, 0x33, 0x24, 0xDA, 0x00)
auto ds18b1 = DS18B20(0x28, 0x01, 0x00, 0x33, 0x24, 0xDA, 0x00)
auto ds2433 = DS2433(DS2433::family_code, 0x00, 0x00, 0x33, 0x24, 0xDA, 0x00)
unsigned long EEPROM_lPowerCount0
unsigned long EEPROM_lPowerCount1
auto hub = OneWireHub(pin_onewire)
uint8_t mem_buffer[144]
uint8_t mem_read[16]
constexpr uint8_t pin_button { 2 }
constexpr uint8_t pin_led { 13 }
constexpr uint8_t pin_onewire { 8 }
unsigned long time_last_update