Month: June 2014

Aquaponics with TI MSP-EXP430FR5969

Project Supervisor: Teo Shin Jen (

The Singapore Mini Maker Faire is coming up in about month’s time and I am thinking of making something new with the MSP430. I thought of doing a tweeting monsoon drain/weather station. Currently there is no way to tweet directly from the MSP430, although Adrian from TI had made it possible by using the computer to help the MSP430 tweet. However, its not possible to put bulky computer in the drain with the MSP430. (Think about the costs of waterproofing it, its not pratical). So I thought of making a home automation system, with a smartphone/PC controlling it by means of a website with the MSP430 being the local server. It requires a CC3000 WiFi boosterpack, but at that time it was out-of-stock. I don’t really have much time to wait, so I ditched the idea and went on.

Final idea is to make a MSP430 controlled aquaponics system. It would have sensors and pumps to control water flow which I will describe later on in the next post.

My idea of this project is to solve the problem of food growing. In Singapore, costs of fruits and vegetables are rising, partly due to we import some of it. Common vegetables are grown hydroponically here.



You’ve probably heard of ‘hydroponics’. Aquaponics is actually a portmanteau of two words – Aquaculture and Hydroponics.

There are 2 systems – The hydroponics system and the aquaculture. Basically what is does is to pump nutrient-rich (fish wastes) water and use it for hydroponics. This will reduce costs by a large amount, as hydroponics chemical solutions are not cheap. The bacteria in the plant roots will break down fish waste into nitrates and nitrides, of which then the plants can use. The only input into the system are fish food and water. Water has to be changed every 1-2 weeks to prevent bad bacteria build up.

The diagram on the right shows how the real thing would be. A pump is used to transport water from the fish tank to the hydroponics and the ultrasonic sensors as water level sensors. But because it takes a lot of time to make it, I will be just making a proof-of-concept.

The 2nd diagram shows how the proof of concept will be done (minus the solar panel). There will be no fishes used and instead I will be using an organic fertilizer mixed with water to simulate the fish waste. I am using the drip system as it is the easiest and not too sensitive.

(Types of Hydroponics Systems)

pH,ammonia and oxygen sensors are ridiculously expensive, so I will be skipping them. I am currently working on a DIY water-resistant TMP36 temperature sensor.

Making a DIY Water-Resistant Temperature Sensor


I used a LM35 Temperature sensor due to its convenience and ease-of-use.

According to the datasheet, it takes any voltage from 4V to 30V and outputs a linear-calibrated voltage proportional to the temperature for a maximum of 1.5V at 150°C.

Although it requires at least 4V, it seems that 3.6V works just fine. There is, however, an unpopulated pin hole on the launchpad providing direct 5V from the USB connector. The guide can be accessed from here. I’ll definitely use that pin for the LM35 for optimal perfomance

I used a rubber tubing to cover the sensor. It fits very snugly and then I used some hot glue to seal it up. Not the best method, but hot glue is fairly water resistant as I don’t have waterproof silicone glue.

This slideshow requires JavaScript.



I bought a large tub from the 2-dollar japanese shop Daiso. I then drilled a large hole for the tubing. Originally I used a rubber tubing and hot glued it to the tub. However, it seems that hot glue does not stick very well to that type of rubber. Instead, I used a plastic angle connector and then applied a generous amount of hot glue.

The diameter of the outlet of the connector is a little bit smaller than the inlet of the pump. I applied some hot glue and while it is still hot, I quickly squeezed it in. The pump is from an old water boiler and uses 8-12V. It can however run on 5V, but it is too slow for practical use. Anyway my plan is to use a 12V power supply for it and it will be controlled by a transistor.

I did a test run and it seems that the hot glue seal is doing quite well.

This slideshow requires JavaScript.



I would say that programming is one of the most time-consuming parts of this project. There are quite a few parts to the code:

1. Clock Time adjustment function

2. Clock Time Advancement

3. LCD Updating Code

4. LM35 Code

5. Ultrasonic Sensor Code

6. Motor PWM Code

7. LDR Code (If I have time)

I won’t go too detailed into the parts of the code as it is too long.

The clock time advancement codes I partly copied it from code meant for an Arduino alarm clock.

The code for the clock time adjustment function itself took about 130+ lines of code. I wrote all of them from scratch, as I didn’t really fully understand the codes that I found online. Moreover, the method to adjust the time I used is different than theirs.

The code for the LCD was pretty simple, everything was adapted from the library that ‘Chicken’ from the forums wrote. He also recently made the library capable to display .h bitmaps image files in the LCD, upon my question/thread on the forum on how to display .h images on LCD here. Special thanks to Chicken!

The ultrasonic sensor and LM35 code is fairly simple too. The ultrasonic sensor code I took from the example sketch in energia. Since the LM35 outputs a voltage proportional to the temperature in deg C, I used adafruit’s LM36 code to get the temperature. At first, I didn’t know that the Wolverine Launchpad has a 12-bit ADC (Analog-To-Digital Converter) which means that its analogWrite() outputs 0-4096 instead of arduino and the G2 launchpad’s 10-bit ADC 0-1024. I was getting false readings and for 2 days over 3 hours I couldn’t solve the problem. I had asked the 43oh forums and the great community there pointed out about the 12-bit ADC.

As of the time of writing, I haven’t finished intergrating the motor PWM code into the main program. It should be easy and just a few lines.

Making A Boosterpack

I am making a boosterpack for the launchpad for easy connectivity.

It is where the Temp sensor, ultrasonic sensor and motor(pump) controller will be connected to the launchpad.

The LM35 requires 4V, while the SRF05 ultrasonic sensor requires 5V. However, with testing, it seems that both of them work just fine at 3.6V (Which is what the launchpad provides at Vcc).

I used fritzing to plan out the circuit first. Then, I soldered the 20-pin boosterpack pin headers.

I made some DIY manual-crimped standard 2.54mm connectors for the pump, ultrasonic sensor and the temperature sensor. It was quite tedious, but it is convenient to remove/connect after that.

For controlling the pump, I used a TIP110 transistor with a 1K ohm resistor to limit current into the base.



Since I didn’t have a water tube for the pump, I had to buy one at a Local Fish Shop(LFS). It was amazingly cheap, I bought a 2m long small tube for 80 cents. It was meant for air bubblers, but since my pump isn’t that high pressure, it should be enough.

When I tried the tubing on the pump, the whole tube could go into the pump’s output. It was too small. I used some PTFE plumber’s tape and taped the end of the tubing. It fits quite snugly. I had also cut a few slits on the other end of the tube so that the plant roots can get consistent water supply.

So far, I have been running the pump and I have not gotten any leakages. The only leakages came from the connector connecting the container to the pump.



Originally, I had bought a chilli plant but it unfortunately died due to lack of sunlight. I then bought a hydroponically-grown basil plant but it also died due to lack of sunlight. I also bought an unknown flower plant but it also died due to lack of water. Seems like I don’t have green fingers.

With all the 3 plants died, I bought a spring onion that was meant for cooking for $1.10 . Since it was meant for cooking, I placed it in the fridge to make it last longer until I need it on this saturday.

So far, I have left the spring onions for 24 hours with the pump turning on periodically and looks like it is working as well as it should.

As for the planting pot, I designed it myself using Autodesk Inventor and then 3D printed it on the Makerbot Replicator 2. The model with the STL file is available here:


For the plantation media, I used some small pebbles/rocks. I chose to use small rocks as they can retain water easily. Also, it filters out solid waste which be used by the plants for nutrients and gives out clean water for the fish.


Trying Out The New TI MSP430FR5969 LaunchPad

So one day I was reading about surfing the net on DIY stuff and I came across the TI LaunchPad. It looks interesting, and its cheap too. Programming wise, its using almost the same IDE as Arduino. So I told myself, why not give it a try?
I originally thought of buying the EXP430G2 board (USD 9.99), but there was a better deal. The EXP430FR5969 Eval board + LCD Boosterpack Bundle boasts more features than the latter. It has a 64kB FRAM,  a 0.1F supercapacitor for batteryless applications, includes a Sharp Low-Power 96×96 LCD with 2 capacitive touch sliders on it. The LCD itself costs USD 19.99 but the bundle only costs 29.99. Its definitely a good deal! Also, shipping by Fedex is free!
I also ordered some (3 actually) models of bare MSP430 ICs, 2 each, through TI’s sample program.
1. MSP430G2201IN14
2. MSP430G2111IN14
3. MSP430G2121IN14
The MSP430FR5969 bundle with the LCD comes in a large blue box while the G2 comes with its own smaller box.
Inside the G2’s box we find:
1. MSP-EXP430G2 LaunchPad
2. MSP430G2553 microcontroller
3. MSP430G2452 microcontroller
4. Mini-USB cable
5. Quick Start Guide
6. 32kHz external crystal
7. 2 TI Launchpad Stickers
8. 2 Female Headers
While the other box contains:
1. MSP-EXP430FR5969LP board
2. Micro-USB cable
3. SHARP96 Booster Pack with LCD and capacitive touch sliders
4.Quick Start Guide

This slideshow requires JavaScript.

8/6/14 (Edited and added content 15/6/14)
Since the G2 is for my lecturer, I didn’t cut open the anti-static bag so I didn’t get a chance to try its out-of-the-box example
I did however got to try the FR5969 with the LCD boosterpack.
Its preloaded with several demo applications:
1. Clock
2. FRAM speed
3. Battery Free
4. Active Mode
5. SliderBall Game
The first thing I tried was the SliderBall game(Kinda like pong). The capacitive touch sliders are used to control the paddle.The capacitive touch sliders weren’t that senstive, but it worked okay.
I also tried the battery free application. This app will make the FR5969 go into LPM(Low Power Mode) 3.5, which is one of the many low-power modes the microcontroller offers. It literally can last for more than 8 hours with the screen off in this mode. There is also another submenu, where there is an option called transfer data. It allows us to transfer the logged voltage readings of the supercapacitor from the FRAM to a PC via back-channel UART.
The FRAM speed application is to demo how fast writes on the FRAM can be (At around 7564kBps) and the endurance.
The active mode application allows us to measure power consumption of the MCU. The power consumed is dependent on 3 things: the code, data cache hit ratio and clock speed of the CPU. There are various options to allow us to change the operating frequency of the CPU and cache hit ratio.