loading

(A LinkIt ONE project)

The Overture (a rambling intro)
When the nice people at Instructables put a flyer out, asking what projects could make use of a 'LinkIt ONE', I read the specification, and it quietly dawned on me, that the capabilities of this board meant I could use it at the heart of a project I had discussed with a friend who is building a narrow-boat. (If you are not familiar with the canals/in-land waterways of the UK, then you can read up HERE) So I scribbled down a few ideas, sent them off, and blow me, they only said they liked them and sent me a board.

Step 1:

One step forward, two steps back.

Now first off I am not an electronics engineer. I don't design circuits. I can just about follow what they do, but the success rate of my efforts over the years has not warranted doing an instructable.

Following someone else's design is fine, when they have already got it working, but try modifying it for something you want, and you enter uncharted waters. Well it shouldn't be like that, so I decided to investigate circuit emulators, to get my project off the ground, and ultimately on to the water.

Electronics - Without the magic smoke.

The first piece of software I tried is called "Crocodile Clips". It's quite old now and no longer available, but it did prove to be a good starting point.

The first circuit I wanted to produce was a simple power indicator. The source of DC power on a narrow-boat is called a leisure battery. The one that is going to be fitted is rated at 12V 125Ah, and there are two of them wired in parallel.

This circuit proved to work well in the emulator. At the nominal 12V the green LED is on, and the red LED is off. Reducing the battery volts to 11V turns the green LED off and the red LED on. This type of battery, when it drops to about 11V is due for a recharge, which is a condition I wanted to check for. In fact this circuit according to the emulator will survive 24V, which is a worst case scenario, if someone was to wire the two batteries in series!

The 'Crocodile Clips' library has a transistor that is non-specific, and you can't create or add your own. So it was time to move on.

Step 2:

The second piece of software I discovered is the successor to "Crocodile Clips" and called "Yenka". Created by the same people, it has the same feel to it. Being less quirky, it is an improvement over the original, so recreating the circuit was straight forward. This is free to download, but due to its "Education" licence you are only allowed to use it "out of school hours". Fine for the home hobbyist but it does mean you can't use it at lunch time! Grab it HERE

Yenka is an improvement over the previous incarnation. You can insert both meters for volts and current from the same library menu window (Crocodile Clips has only a voltmeter on its button bar, to get an ammeter you have to go into a sub menu. Did I mention it was quirky?).

As you change the battery value, the LEDs change brightness. If you get a value wrong, like when I put a 330R in for the right hand 470R resistor, you get a nice animation of the LED going into melt down! The libraries have improved as there are more transistor types to choose from.

This is the point where I went into uncharted waters. The voltage presented to the red LED is 1.9V. The 'LinkIt ONE' has 3.3V digital inputs; I wanted to know if this was enough to trigger one of the inputs. According to my web searches, the minimum input voltage is 2.0V that a TTL device expects. This was something I couldn't find on the MediaTek web site, or the forums there. Fortunately doing a web search I discovered a thread on this forum HERE

I assumed that the red LED and the 1k resistor formed a potential divider, and a simple reduction in value of the 1k resistor would give me a voltage increase presented to the LED. So I started to change the value down the scale of available resistor values. Yes the voltage went up as the resistor value came down, but only 0.01V per change. So the value kept going down until that nice little animation was back as the LED when up in virtual smoke. This circuit was not going to work without a few more components.

Step 3:

So here I present my master stroke circuit, (drawn in both emulators, to show the differences). The relay pole shown connected, is to give a "hard" switch-over to the centre zener diode, which as indicated by the volt meter gives a definite change over from 0 to +3 (and a bit) volts, ideal to feed a digital input on the 'LinkIt ONE'. The second pole will serve as a changeover between the two battery supplies, to power the board.

There are a number of benefits with introducing the relay in the second circuit. Firstly the "DigInPin" gets a clean 3V3 voltage via the zener diode as the way it works is to clamp the voltage to the pin, so you don't need a pull-down resistor as used in a switch circuit HERE

Secondly, the relay changes over from the main battery which is now compromised, to a back-up battery. It would have been nice if I could have used the 'LinkIt ONE' on-board Li-Battery, but this is only available via a manual change-over switch on the board from the USB power source.

Running the circuit through two emulators had some interesting results. In “Crocodile Clips” there is only one relay package available, which is non-specific for the voltage the coil can work with. “Yenka” on the other hand has a selection of makes in 5V and 12V coil ratings. The difference showed up in a 1V difference in the threshold that the relay toggled, so the ‘virtual’ coil resistance obviously makes a difference.

Step 4:

The ‘LinkIt ONE’ expects to get its external power through the USB port. My circuit works from 12V battery sources, so I need to step it down to 5V to run the board. Now I could simply use a L7805 regulator as used HERE but the circuit shown there feeds in through one of the headers pins that prevents fitting a shield. Fortunately I have a spare USB car charger which I opened up to hard wire to the relay’s power change over pole. I managed to read the text on the chip in the device, and found the data sheet on-line which shows it to be both a protection and regulator chip, very reassuring! Also it was cheaper to use/buy than a discrete regulator and capacitors. More importantly it has USB sockets, which lets me use a standard lead straight into the 'LinkIt ONE'.

So now I have a circuit I can be reasonably confident I can build and tweak in the real world without destroying components!

I had planned to draw up the circuit for the ‘Bread board’ and have a play with using "Fritzing" and the “123D Design”. I did intend to emulate the circuits in a serious piece of software called “Tina TI” but seeing as I have a deadline for this article I’ll let you investigate the free downloads.

So that is the battery monitor/change-over side. To send SMS messages from the 'LinkIt ONE' you will need SIM card from one of the many mobile/cell phone companies.

The reference card you get with the board states you fit a Micro SD/SIM card, I nearly snapped it out of the "Standard SIM" frame before I spotted the full size one fitted in the photo of the Developer's Guide. You have been warned!

If you don't buy a dedicated SIM and use the one from your phone, you may need a destination number to see the message sent. There are a number of web sites that will let you see text messages sent to them, so have a read HERE and try one of the numbers listed.

Step 5:

Time to write some code.

Well I say write code. The included file is really a reworking of snippets of code taken from the ‘Media Tek’ and ‘Arduino’ web sites and the contributions there on the forums. I have left all the comments in there, as it is always helpful to have an explanation of what is going on; understanding it is another matter!

The code is very much work in progress. In this initial form it is a one shot process to register a battery change-over condition. With more work this will become just one section, of a number of functions.

The ultimate collection of sensors and code intended for this board are: -

Use a master "key" switch to change between integrity/security and running monitoring.

Integrity is checking the battery for draining down if something is left switched on while the boat is unattended. SMS text being sent. I also plan to make use of a motor taken from an old toothbrush to use as an audible/vibrating warning as used in mobile/cell phones.

Security is checking if the engine has started without being switched to run mode i.e. theft in progress! This will initiate a number of GPS co-ordinates being sent via SMS text for a given distance from being moored to send tracking data as to the direction the boat is moving.

Running is monitoring the engine block temperature along with the temperature and humidity of the engine compartment, and crew quarters. This data can be sent via Bluetooth to a phone/tablet app which, being portable becomes a dashboard for the person on the tiller. There will be additional sensors to monitor the tank levels for Diesel and water.

It has even been suggested, that if the board was set-up to receive text messages, then the heating could be turned on remotely in advance of the boat being used!

Step 6:

Summary

I have probably got a few things wrong with the project, both in the approach and execution of what I am trying to achieve. But the whole point of a 'LinkIt ONE' board, and the use of circuit emulators, is to have a play and build up experience of what the two can be used for, and possibly, with all the buzz around the idea of the "Internet of Things" develop something that someone else might want to build.

Credit where credit is due.

As I said earlier, I don't design circuits. The source that my starter circuit came from, is from an excellent collection I found HERE from their eBook "1-100Ccts", unsurprisingly it is called "BATTERY MONITOR Mk1". The code snippets you can find on-line where they are credited to the authors. As for everything else, well I have given links to lots of sites, so there is plenty for you to investigate and read around.

Many thanks to Media Tek for making this board available.

Special thanks go to Troy and Nicole at Instructables for staying with me and nudging me along to the finishing line, for this article.

<p>Great system for monitoring batteries.</p>

About This Instructable

817views

9favorites

More by Smelter_uk:Battery Monitor With SMS Texting. 
Add instructable to: