Yet another watering project

Hi all!
I’m a long time developer, first-time duino projecteer.

I purchased a basic kit + a moisture sensor to figure out what all the hype is about, and what would you know - I fell for it!

Before I order more components, I was wondering a couple of questions:

  • Does the WiFI-RS21 work with the Hydra? I need to report readings wirelessly to the cloud, and wifi seems to be the only solution.

  • I was hoping to buy cheap NFC tags and stick them on various plants and have my hydra project serve as a “plant calibrator” - but there is no NFC module on GHI. Do you have some tips for me on that?

My first blog on the project can be seen here:
http://pedro.digitaldias.com/?p=278

Looking forward to reading your comments

Pedro G. Dias

Norway

1 Like

Oh! Premium and opensource boards are incompatible!? Thats a bummer :frowning:
Had I known, I would have opted for a premium board at once - Wifi is fairly essencial to this project

The WiFi Cobra-II would be ideal for this project it sounds.

i think andre.m suggestion of using xbee is good. have you tried it? i think you’ll find it probably will work for you and probably much more cost effective. almost everything i build communicates back to my PC through xbee and have no issues w/ it in my home…i get good reads from basement to attic.

Naw, thats overkill for my needs. I am just after measuring some plant-specific stats (moisture, humidity, temperature, light) and reporting to a service somewhere.

Is there a tutorial for using XBee on the hydra board for WiFi? I am completely new to the duino world, and even though I will probably go for some low-level driver writing further down the line, right now all I want is for my project to land :slight_smile:

Andre, that topic raises more questions than it answers :slight_smile:

So to be clear:

If I understand correctly,

  • the XBee needs to be bought in pairs: one for my hydra board (transmitter) and one for a computer somewhere (receiver).

  • It is not possible for the XBees to be on a wifi and report directly to a WebApi, they have to be connected to a computer that can do it, so the two XBees act as a bridge from the Hydra board to a computer in my house?

  • Assume I already have the Hydra board and the sensors I want. Exactly what hardware do I need? I believe one XBee adapter for the Hydra to put in the transmitter, but what do I hook up to the computer?

  • I am assuming that the XBee config program allows me to set up some sort of channel with an ID, so that when I am opening up a serial port on from the Hydra and computer, they already know how to find eachother? Is that the responsability of the X-CTU software?

  • All the examples that I have seen so far open up a connection and assume that connection to stay up for eternity. Is it stupid of me to only connect when reporting measurements and then disconnecting? I am planning an update interval of 1hr or more.

In advance, my apologies if all of these questions have been posted before. I have read through some pages looking for this topic, but I find the questions and answers given confusing :slight_smile:

Check out the WiFly module.

https://www.sparkfun.com/products/10822

A new wifi module is going to be announced this week, which works with all boards.

:smiley: Cheaper too?

That sounds perfect to me , Gus!

Pin me down for a beta run!
I also see that a 4.3 SDK is right around the corner, will they arrive at the same time?

On the topic of NFC - will there be something available soon?

The “Cheaper” one comes later maybe. This one is not cheaper but it offers something you will really enjoy. More on it in few days.

Many weeks ago I remember Gus promissing something that will allow connecting mobile devices to NETMF very easily and without pain… Is this what’s coming?

sounds like you have some options…i esp like that wifi module in a xbee footprint pointed out by ian. To answer your questions on xbee…

-you need at least two xbee or xbee pro modules (you can add more to expand nodes on your ‘wifi’ network). You’ll also need two xbee adapthers to plug the xbee into, one to interface with your PC and one to interface with your gadgeteer board. The one that interfaces with the PC doesn’t have to be gadgeteer.

-you can use Putty and X-CTU to configure your xbee ‘network’ (there are numerous tutorials on how to do this).

-once it’s configured, its no different than reading/writing to your serial port. The nice thing about that is that there is no dependency on hardware or software…so you can have gadgeteer, arduino, python scripts…all talking to each other. Here’s an example that might help in terms of the code…the server, which runs on my PC can receive or send commands to ‘clients’ (gadgeteer module in this case)…

Server Code:

SerialPort _serialPort = new SerialPort();
        
        public SerialPortHelper()
        {
            
            _serialPort.PortName = "COM3";
            _serialPort.BaudRate = 9600;
            _serialPort.Parity = Parity.None;
            _serialPort.DataBits = 8;
            _serialPort.StopBits = StopBits.One;
            _serialPort.ReadTimeout = 500;
            _serialPort.WriteTimeout = 500;
            _serialPort.NewLine = "\n";
            _serialPort.DataReceived += new SerialDataReceivedEventHandler(_serialPort_DataReceived);
            _serialPort.Open();
        }

        void _serialPort_DataReceived(object sender, SerialDataReceivedEventArgs e)
        {
            string data = _serialPort.ReadLine();
            
            Task task = Task.Factory.StartNew(() =>
            {
                string[] dataArr = data.Split(',');
                double dCelcius = double.Parse(dataArr[0]);
                double dFarenheit = ((dCelcius * 9) / 5) + 32;
                double humidity = double.Parse(dataArr[1]);
                System.Diagnostics.Debug.WriteLine(string.Format("F:{0}, H:{1}", dFarenheit, humidity));
            });
        }

Client Code (gadgeteer):

        private const string DELIM = ",";
        private const string DATA_TEMPERATURE = "T";
        private const string DATA_DISTANCE = "D";
        private const string NEWLINE = "\n";

        static SerialPort xBeePort = new SerialPort("COM3", 9600, Parity.None, 8, StopBits.One);
        TemperatureHumidity _tempHumidSensor = new TemperatureHumidity(2);
        void ProgramStarted()
        {
            xBeePort.Open();
            xBeePort.DataReceived += new SerialDataReceivedEventHandler(xBeePort_DataReceived);
            _tempHumidSensor.MeasurementComplete += new TemperatureHumidity.MeasurementCompleteEventHandler(tempHumidSensor_MeasurementComplete);
            _tempHumidSensor.StartContinuousMeasurements();
        }

        void tempHumidSensor_MeasurementComplete(TemperatureHumidity sender, double temperature, double relativeHumidity)
        {
            string data = DATA_TEMPERATURE + DELIM + temperature + DELIM + relativeHumidity + NEWLINE;
            byte[] data1 = Encoding.UTF8.GetBytes(data);
            Debug.Print("Sending Temperature data: " + data);
            xBeePort.Write(data1, 0, data1.Length);
        }

        //recieve commands from server
        void xBeePort_DataReceived(object sender, SerialDataReceivedEventArgs e)
        {
            byte[] buffer = new byte[1];
            xBeePort.Read(buffer, 0, 1);
            byte action = buffer[0];
            ...
        }

Even OSHW?

ALL boards, even non GHI ones!

The king of tease strikes again!!!

Does that mean it won’t tightly integrate with the board’s TCP/IP stack?

So was it?
The only wi-fi board I see released is the one that does not yet have drivers for connecting my hydra board to the internet.

All I need is to do a POST request to a URL.

I’m quite sure the paired XBee’s aren’t what I am looking for because (1) They only act as a serial port onto a computer, and (2) see (1).

BTW - how do you suggest I read NFC tags?

http://www.ghielectronics.com/catalog/product/444 is the new wifi module