It looks like the WordPress site URL is incorrectly configured. Please check it in your widget settings.
Project Supervisor: Teo Shin Jen (http://shin-ajaran.blogspot.sg/)
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.
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.
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.
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 43oh.com 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.