diff --git a/temp_controller/README.md b/temp_controller/README.md new file mode 100644 index 0000000..df81e2d --- /dev/null +++ b/temp_controller/README.md @@ -0,0 +1,13 @@ +# Temperature Control + +Enables basic thermostat control for fermentation, kegerator, etc. + +## Requirements +Arduino Nano (clone) with ethernet shield. + +For programing the board: + - Board : Arduino Nano + - Processor : ATmega328P + - Port : /dev/ttyUSB0 + +This board/shield combo works with the [EthernetENC](https://github.com/jandrassy/EthernetENC/wiki) library. diff --git a/temp_controller/temp_controller.ino b/temp_controller/temp_controller.ino new file mode 100644 index 0000000..b0cd4ec --- /dev/null +++ b/temp_controller/temp_controller.ino @@ -0,0 +1,45 @@ +/* Built-in */ +#include + +/* Extra Libraries */ +#include + +byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; +IPAddress ip(192, 168, 1, 177); +IPAddress myDns(192, 168, 1, 1); + +// Initialize the Ethernet client library +// with the IP address and port of the server +// that you want to connect to (port 80 is default for HTTP): +EthernetClient client; + +void setup() { + Serial.begin(9600); + while (!Serial) { + ; // wait for serial port to connect. Needed for native USB port only + } + + // start the Ethernet connection: + Serial.println("Initialize Ethernet with DHCP:"); + if (Ethernet.begin(mac) == 0) { + Serial.println("Failed to configure Ethernet using DHCP"); + // Check for Ethernet hardware present + if (Ethernet.hardwareStatus() == EthernetNoHardware) { + Serial.println("Ethernet shield was not found. Sorry, can't run without hardware. :("); + while (true) { + delay(1); // do nothing, no point running without Ethernet hardware + } + } + if (Ethernet.linkStatus() == LinkOFF) { + Serial.println("Ethernet cable is not connected."); + } + // try to congifure using IP address instead of DHCP: + Ethernet.begin(mac, ip, myDns); + } else { + Serial.print(" DHCP assigned IP "); + Serial.println(Ethernet.localIP()); + } +} + +void loop() { +}