Description
This SnipCard can handle two 1-Wire channels or one I2CBUS channel. The card is designed to fit specific components for two opto-isolated outputs (optional mode).
The 1-Wire devices made by Dallas Semiconductor, of which the Seletronica uses the iButton buttons as personal identification device, provide a wide range of products (temperature sensors, actuators, identification devices with unique code etc. …). All these devices can be connected to the same serial bus (two-wire), which allows to easily extend the number of sensors for data acquisition.
1-Wire / I2C bus base board connections
Technical specifications
- OUTPUT A:
- 1-WIRE 1 (or SCL)
- OUTPUT B:
- 1-WIRE 2 (or SDA)
- COM PLUG:
- GND
1-Wire Code example
#include <Archiduino.h>
#include <pins_archiduino.h>
#include <DallasTemperature.h>
#include <OneWire.h>
#include <LiquidCrystal.h>
#include <ArchiduinoLcd.h>
#include <LiquidCrystal_I2C.h>
#include <Wire.h>
#define ONE_WIRE_BUS M8B
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);
ArchiduinoLcd_PCF lcd; // set the LCD address to 0x20 for a 16 chars and 2 line display
int KeyboardPin = PB4; // select the input pin of lcd-keyboard
int KeyboardValue; // variable to store the value coming from the keyboard
int ledPin = LED_RUN; // select the pin for the LED
bool ledStatus;
int rele = RELE_11;
int setupStatus = 0; // flag to 1 if setup mode is active
float setTemp = 30;
float readTemp = 0;
void setup() {
delay(200);
lcd.init(); // initialize the lcd
lcd.begin(16, 2); // initialize lcd and keyboard
lcd.clear();
sensors.begin();
lcd.backlight();
lcd.print(" ARCHIDUINO ");
lcd.setCursor(0, 1);
lcd.print(" TEST DS18B20 ");
delay(1000);
lcd.clear();
pinModeEx(rele, OUTPUT);
pinMode(M7A, OUTPUT);
pinMode(M7B, OUTPUT);
}
void loop(void) {
readKey();
if (setupStatus == 0) {
readTemp = sensors.getTempCByIndex(0);
sensors.requestTemperatures();
lcd.setCursor(0, 0);
lcd.print("PROBE: ");
lcd.print (readTemp, 1);
lcd.print( (char) 223 ); // Degree symbol '°'
lcd.print ("C");
}
stampaSoglia();
if (readTemp >= setTemp) {
digitalWriteEx(rele, LOW);
digitalWrite(M7A, HIGH);
lcd.ledOff();
}else{
digitalWriteEx(rele, HIGH);
digitalWrite(M7A, LOW);
lcd.ledOn();
}
}
void readKey() {
KeyboardValue = analogRead(KeyboardPin);
if(lcd.IsButton1Pressed() && setupStatus == 1){
lcd.setCursor(0,0);
lcd.print ("SETUP COMPLETE ");
delay(500);
lcd.setCursor(0,0);
lcd.print (" ");
setupStatus = 0;
}
if(lcd.IsButton2Pressed() && setupStatus == 1){
setTemp -= 0.1;
stampaSoglia();
delay(100);
}
if(lcd.IsButton3Pressed() && setupStatus == 1){
setTemp += 0.1;
stampaSoglia();
delay(40);
}
if(lcd.IsButton4Pressed() && setupStatus == 0){ // ENTERING SETUP
delay(500);
setupStatus = 1;
lcd.clear();
lcd.setCursor(0,0);
lcd.print ("SETUP");
stampaSoglia();
delay(40);
}
}
void stampaSoglia() {
lcd.setCursor(0, 1);
lcd.print("THRES. : ");
lcd.print (setTemp, 1);
lcd.print( (char) 223 ); // Degree symbol '°'
lcd.print ("C");
}
void ledBlink() {
if (ledStatus==0)
{
ledStatus = 1;
lcd.ledOn(); //led run on
}
else
{
ledStatus = 0;
lcd.ledOff(); //led run off
}
delay(100);
}

