I have finally finished my Data Terminal prototype!
Still have to mount a couple of things, Digital Compass, Barometer, GPS and maybe an SD card reader and one of thos AM/FM/SW receivers.
I'm using a SeeedStudio Mega, There is a DS1307 RTC breakout, a regulated XBee Explorer with a series 1, 60mW, U.FL connector XBee module.
On the prototyping board there is a 24LC256 I2C EEPROM.
On top I have the XBee Antenna jack, with a 3dBi Omni.
The switches will be
- Master Power
- LCD Power
- GPS power, if I can find a spot to mount my EM-406 where it can see the sky.
The LCD is a SparkFun HUGE LCD with serial back pack.
It's a great display, but forget buying a civilised case! It's just too big!
At the moment all it does is show the time and the "Up"/"Down" buttons change the LCD brightness.
The buttons are rated IP67, so they will be splash and dust proof, also tougher than the rest of the unit.
I've put together 2 of these Mega/XBee prototyping rigs.
After ripping the U.FL connector off a U.FL to RPSMA lead, I decided to put together something a tad more robust.
The 2 nodes are identical.
- Genuine Mega
- SparkFun XBee shield, I use one of the hardware ports, so I cut the link, switch to "DLINE" and run 2 leads to Serial3 in this case.
- DF Robot protoyping shield, with an SHT15 temperature and humidity sensor
The codes on the nodes look like this
#include <Sensirion.h>
const uint8_t dataPin = 2;
const uint8_t clockPin = 3;float temperature;
float humidity;
float dewpoint;Sensirion tempSensor = Sensirion(dataPin, clockPin);
void setup()
{
//XBee UART
Serial3.begin(9600);
}void loop()
{tempSensor.measure(&temperature, &humidity, &dewpoint);
Serial3.print("Barn 1: "); // This is the only difference, the other
// node prints Barn 2:
Serial3.print("Temperature: ");
Serial3.print(temperature);
Serial3.print(" C, Humidity: ");
Serial3.print(humidity);
Serial3.print(" %, Dewpoint: ");
Serial3.print(dewpoint);
Serial3.println(" C");
delay(2000);
}
Back here in the house, I have my XBee "Base Station"
I have it hooked up to one of my ASUS eee's, a 701, running Ubuntu Netbook Remix, a variant of Hardy Heron.
(no, I didn't buy that Porche mouse! My girlfriend did! Makes a great night light!)
As you can see from the code it is just the Sensirion example printing to the XBee.
The arbitration or anti collision is being handled by the XBee's.
The couple of times Barn 2 has not shown up here is due to farm traffic, both nodes are in great big Faraday cages, 100 odd metres away.
I'll write better code, but, as an exercise in saving me extra exercise walking down to the barn's every half hour, it's great!
A friend of mine just said "Why bother?"
He is a grep, awk, sed freak and has written a bash script to log the data.
Hmmm, why didn't I think of that?
Anyway I'm thinking of "packaging" up the data like a GPS sentence.
$BARN1;Txx.xx;Hyy.yy;Dzz.zz;$END;
$BARN2;Txx.xx;Hyy.yy;Dzz.zz;$END;
I'm not sure if I need a checksum, what do you guys think?
Well that's as far as I got today.
The data terminal/ArduTablet was originally going to be my "Tricorder" or "Tracker Jacker"
Originally it was going to be stuffed with as much sensing gear as I could cram in.
There was going to be a companion unit on my dogs walking harness with an Arduino, GPS, compass and XBee.
The idea was I would be able to know where my dog was when we were out walking or hunting and I lost sight of him.
Sadly, I had to have Kanada euthanised a week ago.
He was the last of my 6 dogs that I moved up here with.
It was so unexpected, he was only 8, I thought I'd get at least another 4 - 5 years with him, just going on how long the others lived.
They all lived to 12 - 18! Nanook, White Dog's Gran, was 6 days shy of 18!
He is with his mum, dad, sisters, brothers, uncles, aunts, Grandma and Grandpa now.
This is the first time in 25 years I've not had a dog next to me and the first time in my life I've not had a pet.
I will build a "Tracker Jacker" and remote unit, borrow my friends dog to try it, but not just yet.
Anyway that's my Barnduino and "Great Big Thing"!
I consider this my first "real" Arduino project.
Up to now I've just been messing around with breadboards double sided taped to bits of acrylic or MDF.
It's been fun and a good way to learn the language.
The Barnduinos will eventually be 328's with a Sensirion Temperature and humidity sensor and a serial link back to the barn control room.
Whether that link is an XBee, RS-232 or RS-485, I haven't decided yet.
It's way over kill to use a Mega the way I am now!
Especially a genuine one!
The SeeedStudio Mega Clones are great value for money, less than half the price.
I'll be using one of those to collect data from a few of these nodes in each barn as well as data from flow sensors on the bird water lines.
We also need more flexible control of our lighting.
The ability to shut off the water lines in the event of "abnormal" water flow is being considered as well.
I have broken the whole project into separate modules.
Normally I do my hardware and software development that way.
Especially with software, I think of writing code like I write fiction or other prose.
A new paragraph should be a new idea, or new setting, or change of pace.
So too with coding, a new unit (what do we call them in Arduino?) for a new idea or unit.
I have separate unit for each of my sensors, the LCD, keypad, etc.
I use a separate tab in the IDE for each unit and the main tab is what binds it all together.
Old school Pascal head still writing units!
Oooops!