Wednesday, March 9, 2016

Bluetooth HC-05 module

Hi there! I bought a HC-05 bluetotth module and am writing a few lines because it is quite different to manage when compared with the previous HC-06 (which is quite easier). So, let's see:
On HC-06 to enter AT mode you just have to connect to the device before it synchronizes with a BT device. HC-05 needs the KEY or EN or ENABLE or WAKEUP pin to be connected to VCC (3.6 - 6V). An other way to achieve the AT mode is to press the available push-button to 'on' while booting the device, though this will lead to "mini" AT mode instead of "full" AT mode, and in "mini" mode not all AT commands might work.
So, let's see a list of the PINOUT:

KEY/EN: This pin has to be pulled high to enter "full" AT mode;
VCC: Indicated within a range of 3.6 to 6 volt;
GND: Ground;
RXD: Serial input pin;
TXD Serial output pin;
STATE: It's an output pin that can be connected to a LED (with a resistor) which will light up when a BT device is synchronized with the HC-05.

 Then, the console should be configured at 38400 baud (HC-05 default) and change "no line ending " to "both NL & CR".
With the console working type "AT" (without the quotes) on the serial monitor and press enter. if "OK" appears then everything is all right and the module is ready to take command. Now you can change the name of the module, retrieve address or version or even reset to factory settings. To see the default name, type AT+NAME. The name will be prompted, by default it is HC-05. To change the name just type AT+NAME=desired_name.
Important note: if the key pin is not high, (not connected to Vcc while receiving AT commands), it will not show the default name even after giving the correct command. You can still change the name by the command mentioned above. To verify if the name has really changed, search the device using your pc/mobile. The changed name will appear.
To change baud rate, type AT+UART=desired_baud_rate. Exiting AT mode will work by sending AT+RESET command.

Some useful HC-05 AT commands:
AT : Check the connection;
AT+NAME : See default name;
AT+ADDR : See default address;
AT+VERSION : See version;
AT+UART : See baudrate;
AT+ROLE: See role of bt module(1=master/0=slave);
AT+RESET : Reset and exit AT mode;
AT+ORGL : Restore factory settings;
AT+PSWD: See default password;
More detailed AT commands are given in the 1st pdf.

HC-06 AT commands are more limited, though it'll do the job.
AT : Check the connection;
AT+NAME: Change name. No space between name and command;
AT+BAUD: Change baud rate, x is baud rate code, no space between command and code;
AT+PIN: Change pin, xxxx is the pin, again, no space;
AT+VERSION: Shows version;
More detailed AT commands are given in the 2nd pdf.

Wednesday, December 23, 2015

The bluetooth disruption

Well... As I needed some lighting at "Lantern Garden" I bought two 12 V/10W LED projectors and assembled them in the rural field, though I had a problem, where do I put the light switch? And what about rain? It will be ruined very soon... And humidity in the area is quite heavy, so I decided another way, but it needed planing and more hard-work!
At left you can see the light pole and water-resistant distribution box with the projectors assembled (they already have some corrosion because of humidity...).
My decision was to use a bluetooth device I bought for quite sometime now, and to increase the area covered by the signal I put a small waterproof box about 20 meters from the main box, as I need to light up outside the area and not inside it, otherwise I would enter the field without light.
The picture on the right has the bluetooth device already connected and about to be closed inside his "home". For getting it to work I assembled an arduino (wich gave me a huge headache with the resonators I bought, they simply didn't work!) which interprets the bluetooth signals and transfers it to digital/analog pins, at the moment it only lights the projectors, but.. the sky is the limit!
To drive the 12V/10W LEDs I used a TIP120, and it works fine as you can see on the picture on the right and the bluetooth signal gets quite far, I'd say.




Thursday, June 4, 2015

Wateringduino (the end)

This post is intended to celebrate the full production of wateringduino, which is logging and working with 3 watering circuits 365/24/7.
As it is important to have an idea and execute it correctly, more important it is to finish a project! Job's done! Cheers!

Thursday, April 23, 2015

Well volume measurement - Theory (Part I)

Hi there! My post today is more theory than practice, but this is also needed.
When I thought of making a weather station, one of the items I wanted to acquire is the well water volume that I have, this way I can study the water dynamics and learn something about it and its use.
To do it there are mostly 3 ways:
- Ultra-sound device pointing to the water, acquiring the water level.
- Pressure measurement device on the bottom of the well, enclosed in a waterproof box with some membrane allowing the inside of the camera to increase/decrease pressure, measuring the water weight.
- Pressure measurement device on top of the well, enclosed in a tube, filled with the corresponding water level, measuring the water column.
Knowing the depth of the well and the diameter of the rings we can calculate the volume of water using the formula:
V = π radius2 height

The first option is expensive regarding good waterproof ultra-sound sensors, the second has the water-proof design flaw, which is difficult do go around, so I aimed for the third option, which uses a physical principle that can be consulted here and here.
Basically it's something like:
A sense tube is connected to the pressure sensor which resides on top of the water column. The tube goes all the way down to the bottom with an opening near the down end, forcing water to go into the tube. When the liquid fills the well, it also fills the tube till the same height. The trapped air in the tube is compressed, being measured by the sensor on the top of the column. The increase in pressure is proportional to the depth.
Regarding my case, and taking consideration of this: 0.1 meter H2O (conventional) = 98.0665 pascal, and knowing that I have a 7.8 meters depth well, a totally full well would return 7649.187 pascal, an empty one would return something like ambient pressure (on top of the well) minus 7.8 meters depth (easy huh?). The mentioned value allows us the use of a 0.1 meter resolution (used as resolution base value) which means an amount of about 31,4 litters up or down.

Wednesday, April 8, 2015

Agentuino

Quite a while ago I bought an ethernet shield for my arduino, and since then I wanted to use it on my weather station. You may ask why, first it has an integrated microSD shield, and secondly you can use it by issuing SNMP commands to set/get variables and create, afterwards, RRD graphics. The complicated part was to get a compliant library to manage decently the SNMP commands, I didn't find what I wanted, so... I changed the source code to make it happen!
I used the agentuino library, lots of info here: agentuino
The changes I made will not work with the "old" Agentuino.h, as it is incapable of dealing with FLOAT and to set values other than strings, so, you can use my changed library, replacing the old Agentuino.h file with this one. Using it you can manage to do some simple testing like setting an LED on/off, or even fading it (if using a PWM port) this simple examples can be taken to other levels, and you may use your network connection to automatically or manually setting the house-lighting on/off or fade it, start/stop the loan watering (it can be automatic using a crontab command, for instance) among other things you may remember may be useful.
The code I developed is available here and I called it weatherduino because it's intended to be used in the weather station, but you can call it whatever you like and use it freely as long as you link the original work to this page. At the time I'm expanding it to support the arduino MEGA.

Sun tracker - part I

A couple of weeks ago I got some new (used) batteries for my solar station, as you can see on the picture on the right. If they were new, I'd have something like 36 Ah, but they where on heavy duty, so I'll be happy with a humble 20 Ah. Nevertheless it came to me that if my solar panel was equipped with a solar tracker I'd increase the power production in something like 20/40% , having a more profitable battery bank. FYI the most important tracker is the E-W axis, the N-S can be almost neglected and it'll be suffice having an arm setting position for Summer, Autumn/Spring and Winter times.
For the tracker motor control I bought a couple of H-bridges, in this case the L293D, described in the bottom picture:
The chip deals with 600mA max current, tolerates peaks of 1.2A. It uses 5V for regular working, except for pin 8 which should feed the needed motor voltage (in this case I'll use 12V), needless to say that the GND pin from the 12V power-source should be connected to the GND pin of the 5V power-source.  I must say that the electronics part is quite easy to achieve, the difficult part is to manage to create a cheap and robust mechanical system, I disassembled an old HP deskjet printer and used the tray motor, it uses 19V nominal, 24V max, quite good to use in this project with 12V, it drains only 150mA of current (I measured 200mA, 400/450mA if holding the wheel). I'm now assembling it and will have pictures soon! The electronics and programming will be showed up also at that time.
The L293D truth table:

Weather Station - part I, sensor shield

Hi! I've been away for some time, but still doing things, just not publishing them as regularly as I would like to...
Well, but getting back to work , using some vase plates, of good plastic (they do not break when drilled) I managed to create a sensor shield, using 7 small plates, 2 bigger plates, 3 spacers like the ones on the right image and 3 screwed bars of 15 cm each. Drilled a big hole in the middle for a plastic tube on 6 of the small plates, leaving the big ones untouched  and on of the small ones. The objective is to create an insulated, rain free area inside the plates.
So, I have plastic plates, which the sun will possibly warm up during summer, but they are spaced allowing the air to flow and the sensors are inside an acrylic tube which is made of a rather different material preventing the warming up/cooling of the inside, hence, better isolation.
You can see on the left an almost finished view with a large plate, some small plates, a spacer and the acrylic tube. The finished piece is downside. It'll be painted on a more neutral color, like white or pale grey (I have a bottle of paint spray with this color, so why not use it? :D ).
The next step is to seal the upper and bottom holes with mosquito net, to assure I don't get unwanted guests inside, and then I'll wire cable from the arduino Mega box (possibly CAT5e which I have lots of spare meters) to connect the 2 (planned) sensors inside, a BMP085 barometric pressure and a HIH-4030 humidity/temperature sensor.
Afterwards I'll need another shield like this one for the luminosity sensor (hasn't arrived yet). A piezo will also be used to detect the rain intensity. The wind vane and anemometer will use a different housing.

Cheers!



Sunday, March 29, 2015

Wateringduino (again)

Though I have posts about wateringduino, I haven't show it on the field, so, here it is:
On top-right I have the TIP120 power circuit to drive the solenoid open/closed when strawberries dry, you can't drive the solenoid directly, it works on 12V, arduino uses 5V and the current it drains (about 800 mA) would blow up the ship even if it used 5V. On the left there's the RTC (Real-Time clock) which supplies the date/time for the logging purposes, with this I know exactly at what time it waters the strawberries and allows a more advanced logger (spreadsheet graphics allowed), as we saw in a previous post. The SD label is an SD shield with a 32 Mb (yes, it's more then enough, and I have to recycle things) microSD card in which the .csv data files are recorded. The "brain" is the arduino circuit, homemade as it gets cheaper than using a bought board, it has (as previous posts refer) 3 circuits only one is working now, just because the other 2 solenoids haven't arrived yet, it will water the trees and blueberries/raspberries/blackberries very soon. The item marked as power-source is as it is, a power-source, which receives 12V DC and generates 2 outputs, one of 5V for arduino and stuff and one of 3.3V for the SD card. IMPORTANT: never try to drive SD cards with 5V, you'll blow them up!
On the left, is a picture of the homemade probe which measures the moist in the soil, the pic was taken a couple weeks ago and the berries are quite bigger now. I must say that the dry-up problem they had last year no longer happens!
I'll get back to this as soon as I get the ordered solenoids, and I'll post the code also, which has changed since the last time, namely the .csv file format as I realized that the old format wasn't graphic friendly, it needed a lot of hammering to get it compliant with the needs.

Cheers!

Wednesday, March 18, 2015

Arduino ISP shield

Hi there! I finally managed to get the ISP shield on tracks, here you have some pictures, I just need some fresh ATmega328 to use it! :)

Initial circuit and pieces
Piezo soldered
Piezo and Leds in place
On top of the main board, quite nice ah?..
Downside, a little messy, but better hidden than at sight!!!