The Wifi Caravan Monitor


So after looking around the local Anaconda on the weekend I came across a Bluetooth battery monitor the BM Pro which I thought was a great idea. Then I glanced at the price tag… $250.99 AUD and thought there’s no way I couldn’t make a similar system myself.  I’ve already got a microcontroller to play with (Arduino Uno) that I haven’t used in anything.  Surely I’d just need to measure the voltage – Process is somehow and send it out over Bluetooth to a connected device.  Then the part I don’t know how to do – Program an android app to display that info.

From that simple seed of inspiration, I had another eureka moment.  I’ve already got the van router so why would I both using Bluetooth.  Let’s send information around the van from various sensors via wifi and have the router do the processing.  Then all I’d need is a nice little web page that I could go to on any connected device with a web browser.

From there as with all my projects scope started becoming a problem as my brain kicks into gear and thinks “So we’ll check the voltage this way… ohh squirrel … I can do this, and I can also do that”.  So let define what we’re playing with its capabilities and then what the actual monitor can do for us.

Arduino Uno Specs:

Microcontroller ATmega328P
Operating Voltage 5V
Input Voltage (recommended) 7-12V
Input Voltage (limit) 6-20V
Digital I/O Pins 14 (of which 6 provide PWM output)
PWM Digital I/O Pins 6
Analog Input Pins 6
DC Current per I/O Pin 20 mA
DC Current for 3.3V Pin 50 mA
Flash Memory 32 KB (ATmega328P)
of which 0.5 KB used by bootloader
SRAM 2 KB (ATmega328P)
EEPROM 1 KB (ATmega328P)
Clock Speed 16 MHz
Length 68.6 mm
Width 53.4 mm
Weight 25 g

So from that, we can see 14 digital pins and 6 analogue pins.  Essentially if we think of the digital pins as a way to turn circuits on and off (1 or 0) and the analogue pins as a way to read in values such as battery voltage we can monitor 6 devices which in my case (at this stage of thinking) was enough.

The caravan monitor would need to be able to do the following:

  • Run from 12volts
  • Measure the battery voltage
  • Measure the power use (In amps) at any given time
  • Give an approximate state of charge level (percentage charged) of the battery bank
  • Measure two water tank levels
  • Measure gas bottle levels
  • Communicate with the van router over wifi

Now that we’ve defined what it will do.  How will we achieve this… simple really.

Figuring I’d start with the most basic thing on the list of wants – BATTERY VOLTAGE.

The Arduino uses an analogue to digital converter with a max input of 5V so we need a way to translate the possible max of say 15V down to 5V. We do that with the aid of a resistive voltage divider.  Not going into the details i settled on some resistor values based on what i had laying around and got to work on the code.

Essentially the code was this:

int VoltageReadPin = A0; // arduino pin our RVD sense pin is on
int sum = 0; // sum of samples taken
unsigned char sample_count = 0; // current sample number
float voltage = 0.00; // initilise voltage variable
// Setup Voltage Divider Resistors
int resistor1 = 5000;
int resistor2 = 1000;
float arduinovoltage = 4.95;

void setup()
 pinMode(VoltageReadPin, INPUT);

void loop()
 while (sample_count < 3) {
 sum += analogRead(VoltageReadPin);

 // calculate the voltage
 // use 5.0 for a 5.0V ADC reference voltage
 // 5.015V is the calibrated reference voltage
 voltage = ((float)sum / (float)3 * arduinovoltage) / 1024.0;
 // Divide calculated voltage by RVD factor - Vin/Vout = 6.96V in our example
 voltage = (voltage * 6.77);

 sum = 0;
 sample_count = 0;

 Serial.print(F("Voltage: ")); Serial.println(String(voltage).c_str());

Forgive me if the code no longer works I had to do it from memory as the project has long since progressed to something bigger.

So that gets us the voltage and prints it out to the computer via USB/serial – Now we need to send it to the router/network.  After a few ideas of using a web page etc I stumbled on an article relating to MQTT from hiveMQ.

Essentially MQTT allows for very simple comms over a network and there already exists iPhone and Android apps to work with it…. YIPEE I still don’t have to learn to program for phones.

Now we have two problems – getting the Arduino onto wifi and sending MQTT data

I’d seen a lot of press about a small cheap wifi chip named the esp8266 for less than $10 you could add wifi to your projects hell you could do away with the Arduino all together and just use the esp if you wanted (I needed more than 1 analogue pin). I jumped on eBay and ordered 3 of them.  Only need one for the project but come on – for $6 i can wifi enable anything i like.  lol

Chip arrives – I wire it up, it springs to life – Using a USB to serial converter i can send it AT type commands and make it connect to the van router and ping things etc.  OK.  now how to get the Arduino to talk to my wifi network using this thing.

OK now how to get it work with the Arduino – Turns out really easily.  There’s a library wifiESP that takes care of the legwork for us.  We make a few config lines in our Arduino sketch to tell it what pins the esp is on and it takes care of the rest.  One problem down one to go.

MQTT is just as simple – There’s a library called PubSubClient which we can utilise to publish and subscribe to topics.


OpenWrt Mysql-Server Install

opkg update
opkg install mysql-server
/usr/bin/mysqld –skip-grant-tables&
mysql -uroot

SET PASSWORD FOR root@’localhost’ = PASSWORD(‘password’);

UPDATE mysql.user SET Password=PASSWORD(‘newpwd’) WHERE User=’root’;

ps |grep mysqld
/etc/init.d/mysqld start

Sichtschutz, Screen Protection For Your Windows Desktop

Sometimes you may want to hide what is showing on your desktop, for instance if you notice that someone is going to walk by or approach you in office. You probably would not like your boss to find out that you are playing games during work hours, or your wife that you are shopping at the expensive jewelry store for a gift for her upcoming birthday.

While simply turning off the monitor hides the contents of the desktop, it is at the same time a dead giveaway that you are hiding something.

The portable application Sichtschutz offers an alternative. Sichtschutz, which means screen protection in this context, offers boss-key like functionality. It can quickly display an image on the screen that overshadows the actual computer desktop with its open windows and programs.


You need to select an image from your local system on first start. You can alternatively press the print key on the keyboard to use a snapshot of the desktop as the image that is shown when the program is activated.

This can be handy as it makes the screen look like the standard desktop when in fact it may be not. Just take a screenshot with programs open that do not cause suspicion.

The configuration menu lists additional settings to set the image alignment to stretch, center or tile, to mute sounds and to automatically log off when the screen protection is triggered.

A click on Start hides the program from the taskbar and system tray, and enables the triggers to display or remove the screen protection.

The default key to trigger the protection is F12, the key to return to the previous state is F11.

The only indication that Sichtschutz is running is the process which is visible in the task manager.

Sichtschutz is fully compatible with dual-monitor systems. You can download the portable software from the developer homepage. The program requires the Microsoft .NET Framework 2.0.

© Martin Brinkmann for gHacks Technology News | Latest Tech News, Software And Tutorials, 2011. | Permalink | Add to, digg, facebook, reddit, twitter
Post tags: , , ,

[From Sichtschutz, Screen Protection For Your Windows Desktop]

IpswDownloader, Download Apple Firmware

New Firmware often adds new functionality and improvement to devices. Firmware is recorded on computer chips and therefor an integral part of the device. The best known firmware is probably the bios of a computer’s motherboard.

Apple releases regular firmware updates for their devices, which often add new functionality and improvements like a better performance or battery life. Firmware updates may on the other hand invalidate jailbreaks or tools used to jailbreak devices. In rare circumstances, they remove features from a device.

Firmware downloads are usually offered on Apple’s official support website. The site is a big mess to navigate, and the best option is to filter downloads by product to quickly find out if a new firmware is available.

A better solution is the free program IpswDownloader which is available for Windows and Macintosh computer systems. Ipsw is the file extension that Apple firmwares are provided in. The free tool offers firmware information and downloads for a variety of Apple devices. Supported devices include the iPhone 4G, iPad 1G and 2G or the Apple TV 2G.

apple firmware downloader

Each supported device is selectable from a pulldown list in the application interface. Next to the device pulldown menu is a second menu that lists all available firmwares for the device.
Each Firmware is listed with its version and a code.

The main interface displays additional information about the selected firmware. This includes its total file size, which jailbreak tool is available to jailbreak it and whether it is possible to unlock it. The tools that are mentioned are not linked, which means that users who want to jailbreak their Apple device need to find the program on their own to do so. The device firmwares are large files, usually between 200 and 700 Megabytes in size.

The question that remains is this: Do you really need a tool to download the firmware? It simplifies the process greatly. You only need to run it to download the latest firmware, and provided that the developers maintain a list of available firmwares that is all you need to do.
The jailbreak information are handy for users who jailbreak their devices. Security conscious users on the other hand may prefer to download the files directly from an official Apple website instead.

IpswDownloader is available for Windows and Mac at the developer’s website.

© Martin Brinkmann for gHacks Technology News | Latest Tech News, Software And Tutorials, 2011. | Permalink | Add to, digg, facebook, reddit, twitter
Post tags: , , , ,

[From IpswDownloader, Download Apple Firmware]

The ride on mower

So the back paddock needs a mow. What’s a bloke to do. Considering I mowed the first half of the land here with your standard lawn mower, my knee was killing me at the end of it all.

Borrowed a ride on from a mate of mine.. OMFG!!!! what on earth was I ever thinking to not have one earlier. I look around and the yards to the left of me are no bigger than my last place, yet the people who own them all have a ride-on. Turns out… I’M THE MUG!