Saturday, June 21, 2014

Cheap Ethernet connection to Arduino using ENC28J60 module

      While working on Ethernet projects with Arduino the basic hardware we require along with Arduino is the Ethernet Shield. But the problem is that in a constrained budget the buying one Ethernet Shield is not possible which leads to other options and a good one is ENC28J60 Ethernet chip by Microchip.This is not as smart as the Wiznet W5100 chip based Ethernet shields but are quite useful as those.This post i am going to write all about interfacing the ENC28J60 module to Arduino UNO as well as Arduino mini Pro.I have used EtherCard library for the coding to interact with the module.
          Below is the wiring diagram for Arduino UNO.

#include <EtherCard.h>
#define PATH    "temp.php"

byte mymac[] = { 
  0x74,0x69,0x69,0x2D,0x30,0x31 };
uint8_t ip[] = { 
  192, 168, 0, 8 };          // The fallback board address.
uint8_t dns[] = { 
  192, 168, 0, 1 };        // The DNS server address.
uint8_t gateway[] = { 
  192, 168, 0, 1 };    // The gateway router address.
uint8_t subnet[] = { 
  255, 255, 255, 0 };

char website[] PROGMEM = "";
static byte session;
byte Ethernet::buffer[800];
uint32_t timer;
Stash stash;
float temp_R=0;
int tempPinR = A0;
String cont="";
int led = 9;
int sw1 = A1;
int sw2 = A2;
int sw3 = A3;
String sReply="";

Sunday, June 1, 2014

Room temperatuer logger using arduino and JAVA

 This post is all about a temperature logger module using two sensors(LM35) and uses serial communication to log data to MySQL server. And it does so by using Arduino at the logger end and JAVA at the server.

  The concept is so simple that the Arduino uses LM35 (providing analog output for measured temperature) ,which is connected to one of the analogIn pin of Arduino. The sketch burned to Arduino converts the read value from the pin to corresponding temperature. And it sends the data through the serial port.

  At PC side a JAVA application runs which uses TxRx library for communicating with the serial port. The application reads the data from the serial port and acknowledged to Arduino. It then saves the red data to a database.