The Planted Tank Forum banner

DIY Aquarium Touchscreen Controller

87K views 207 replies 26 participants last post by  Darkblade48 
#1 ·
After seeing some amazing DIY controllers, I'm gonna have a go at it. Just had my Arduina Mega and 3.2" touchscreen delivered yesterday.
The plan is to monitor Temp, pH, dissolved Oxygen and eventually filter output flow. Want to also be able to control my heater, Co2, and LEDS with this controller.
I have never written code before, so this is going to be a learn as I go project :)

Used an existing sketch (Jarduino 1.1) to test everything out, and to give me an idea on how all the code ties in together.



Mike
 
See less See more
1
#162 ·
Finally got Jarduino to work! Took long enough. Turns out I wasnt using the right DS1307 library, and I just had to change the pin settings.

Now I'm going to run through all the code to try and learn all of it. I really appreciate how well commented this sketch is, that will be really useful.

I would love to change it around to get rid of the LED array graph, since I dont use an LED lighting system and get some real time weather data in there, and replace the monitors and alerts pane to include room temp (that one is easy) and the pH values of the tank.
 
#163 ·
I would love to change it around to get rid of the LED array graph, since I dont use an LED lighting system and get some real time weather data in there, and replace the monitors and alerts pane to include room temp (that one is easy) and the pH values of the tank.
Glad you managed to get the code working.

Removing/changing the LED lighting system is not hard, it is just a matter of going through the code and deleting the extraneous data :)

For the real time weather data, do you plan to get it from the internet?

From what I recall, the Jarduino does not have any code for pH monitoring, so you will have to find some examples and cobble it together.
 
#168 ·
ok. Question for you guys. I just bought this and plugged everything in and hooked it up to my computer. Upon plugging in the unit to the USB port the screen does not power up. I also have a 9vdc 650ma wall adapter, so I tried that as well. Still nothing. I noticed that there is a pot on the side of the shield, so I thought maybe this was a dimmer pot. I have adjusted it in both directions and nothing happens. So I unhooked everything and then loaded the Blink sample code. That worked just fine.......

So do I have a bad LCD unit? Bad Interface Board? Any suggestions?

Thanks in advance,

Grimm
 
#169 ·
Those units do not always work straight out of the box and require some code tweaking first.

Since you mentioned that the Blink sketch works, then it is not a problem with your Mega, nor any of the USB drivers that need to be installed for the Arduino to work.

Do you have all the correct libraries installed for the TFT Touchscreen LCD? What Arduino IDE version are you using? There are some libraries that only work with the alpha versions of Arduino, while some libraries only work with IDE versions 1.0 and up.
 
#173 ·
Normally, with the wrong code, the screen will just stay white (at least that shows it is being powered).

Is your screen, at the very least, showing a blank, white screen?

Also, you may want to check that the controller Sainsmart uses is compatible.
 
#174 ·
NO the screen is completely black. Doesn't look like there is any power.

How would I check to see if its compatable? I cant seem to even find this combination on their website. But I was sold through amazon as a complete kit...... so I am not certain where to even begin.

By the way Darkblade, thanks for taking the time to try and help.
 
#176 ·
Yes Arduino is powered through USB and even tried the wall plug adapter. THe sketch Blink works. The LCD is plugged into the shield, then shield plugged into Arduino. No there are no bent pins or anything silly like that. Have spun pot in both directions and there is nothing. A blank black screen.
 
#177 ·
The only other thing that I could of think of then would be that one of the traces/pins might be loose.

Checking with a multimeter would tell you quickly if this is the case (test all the pins and all the connections). You could also use it to check to ensure that the shield is actually supplying the LCD with power.

The following are the specifications for the iTeadStudio shield, but perhaps you can use it as a starting point for the Sainsmart shield (they are all very similar).

http://hifiduino.wordpress.com/2012/04/13/iteadstudio-tft-display-for-arduino/
 
#178 ·
Well it appears that my touch screen is DOA.

I have an 8 point relay module. If I take the 5V from the mega board to the VCC and then take gnd of the mega board and touch on of the signal pins for a realy, it operates the relay just fine.

Now if I take those same two connections from the mega and touch them to Pin 1 (GND) and pin 2 (5v) the touch screen wont even power on. I even tried it with the 3v3 voltage just to see. Nothing.......
 
#179 ·
I am not sure which pins you are connecting it to (which pins are pin 1 and 2; the pins of the shield? The LCD?)

Also, the LCD requires 3.3V, not 5V. You may have inadvertently fried something.

However, if it is indeed DOA, Amazon has a good return policy, from what I understand.
 
#181 ·
After doing more thinking about the screen size I was wondering could we not just hook the controller board etc up to a bigger LCD screen that has touch capabilities, the connections are pretty standard are they not ?

I have an older 12 inch lcd screen that I could buy a touch screen converter kit for

[Ebay Link Removed] it's around 40 bucks for the touch screen kit.


then I just plug the screen in the board.
 
#182 ·
I think there was some discussion awhile back about using other touch screens (i.e. iPad touchscreens). I am not sure what this would involve, but you would have to take a look at the specification sheets to make sure that the right voltage/wiring is done to the Arduino (and whether it can handle the increase in inputs that would be required for two-touch, etc). Don't forget that the existing libraries would be unusable, and you would have to write/find them.

Using a non-standard LCD would be more difficult than using the LCD and LCD shield that have already been optimized for the Arduino.
 
#183 ·
I'm making my own aquarium controller using ipad/android/computer as the interface. The project is over on my forum but I'm just starting. You basically turn your arduino into a web server. Any web enable device can be used to interact with the arduino. You're liberated. You can be on vacation and check in.
 
#186 ·
Other things in life take priority ;)

I haven't had time to look at my coding so far; I have the RTC function up and running, but I want to be able to manually adjust my time as well.
 
#190 ·
Hey Guys, a little update on what I have been doing. I decided to go a different direction with my project. After putting together the touchscreen with several different shields and probes and what have you, I struggled to figure out how I wanted to enclose all of it. I didn't what to just leave the the stack of shields sitting next to my tank, and frankly I didn't need all the control that Jarduino and Stillo offered. What I really wanted was something simple to monitor what is going on with my tank. So after looking around for a while, I found Adafruit's Menta. It is an Arduino controller in a mint tin. Very cool. Then I found their 128x32 OLED display. Perfect. So I snatched one up, picked up a DS1307 RTC (Real time clock) circuit from Mouser, and began work on what I like to call my Wicked Tiny Monitor (I'm from New England, we say wicked). Here's what I have so far:







Now I just need to solder all the components into the prototyping area of the Menta. You can't see this in the picture, but there are two waterproof DS18B20 temperature probes. I am going to cut a hole into the back of the tin for their cables, and another for the pH probe cables. The red stamp on the breadboard is an Atlas Scientific pH stamp. Really cool little gadget for only $28. Now i just need a functional pH probe. The one I ordered from e bay for $15 bucks arrived completely dry and useless. The probe connector and probe stamp will likely be placed in a separate breadboard to minimize interference.

The tiny OLED display will fit perfectly in a hole cut between "Curiously Strong Mints" and "Wintergreen" on the lid of the tin. There will also be a button on either the side of the tin or on the top, next to the screen; I haven't decided yet. I am leaning more towards the side, because I would like to leave the lid as uncluttered as possible. I am also not sure how I am going to mount the OLED display. There are holes on each corner of the display board, and I would prefer not having to drill holes into the tin to hold it. Any ideas?

It's been a fun little project so far, and I think it will be neat sitting next to my tank. It will likely be a fun conversation piece for guests.
 
#193 ·
I'm not sure what kind of example code you are looking for; did you have anything in particular in mind?

The problem with the Uno is that there may not be enough I/O pins for the touchscreen + SD card + any other sensors you may want to use. I believe the touchscreen itself uses ~20 pins already...
 
#194 ·
Which board are you using? Anything for code really. It's just nice to have something to build off of


So far I have 2 UNO boards. A screen. Temp sensor and a RTC and a relay board.

My first few projects I want to build is a sunrise/sunset controller for leds and a temperature monitor/auto shut off for the heaters.
 
#195 ·
I am using a Mega2560 R2.

The problem with your setup is that (for example) my code will not work with your setup (you need to write up some code to pass data back and forth from one Uno to the other.

What screen do you have? The 3.2" Touchscreen uses 20 pins (just checked the specification sheet) for display alone, and another 5 pins for touch input. The SD slot takes up another 4 pins.

This is already more than the number of pins a single Uno has.

However, if you just want to do a temperature monitor/auto shut off, it can be implemented (i.e. if you do not use a touch screen and instead use a normal 20x04 LCD screen (or even a 16x02, etc).

You may want to investigate what type of relay you will want to use (for the shut off of your heater).

Finally, to answer your question regarding sample code, if you are using a digital DS18B20 temperature sensor, the Dallas libraries have some excellent examples that you can just copy/paste into a new sketch. From there, it only takes a few more lines of coding to display the temperature to an LCD screen, much like what I had before.

 
#199 ·
It sounds like I may have to order a larger board. Atleast for the more advanced one later. I should be good for the sunrise one for now. Will code work between arduino board models?
For the touchscreen (if you decide to go that route, it does not appear that you have on yet), you will want to get a Mega.

What you have right now (the LCD keypad) will work fine too. Note that you will need a significant number of pins (Vcc, Gnd, and depending on the board, 6 or 7 digital pins). The RTC will take up 4 (Vcc, Gnd, SCL and SDA), the temperature probe another 3 (Vcc, Gnd and a digital pin), and the relay board will take up 2 (Vcc, Gnd) + x, where x is the number of relays you wish to use (i.e. the number of banks of LEDs you want to control). Communication between two Arduino boards can be done using either SPI or just serial (both will take 2 pins, but with SPI, you can use the same SCL and SDA pins as the RTC).

One issue I can see is that you may need a proper LED driver instead of the relay board to do the sunrise/sunset (PWM of the LEDs) feature that you want.
 
#200 ·
Well I think i will to do another order. These 2 wil work well for the mini project but a bigger board will be needed for the main all in one.

So an atmega board, pwm, and a touch screen controller should do the trick
thanks for all the info.. its been years since i have played with anything but basic electronics so any tips/help is appreciated!
 
#201 ·
What you have right now can be implemented using just one Uno.

The Mega and the touchscreen will work nicely, though programming front end stuff using low level coding is such a pain... :rolleyes:

The Mega is already capable of PWM, but you will probably need the proper LED drivers/driver board to control your LEDs.

Otherwise, the relay board will just do a straight on/off (no dimming), which isn't what you want (I assume by sunrise/sunset feature, you want a gradual brightening/dimming).
 
#202 ·
My getto initial thought was to have multiple strips and slowly turn more and more strips on but a PWM is a much cleaner solution.

So would i need a PWM + a driver.. or just a dimmable led driver?
Would a stepper/motor driver work for a led dimmer? (something like this , this or this
 
#203 ·
My getto initial thought was to have multiple strips and slowly turn more and more strips on but a PWM is a much cleaner solution.

So would i need a PWM + a driver.. or just a dimmable led driver?
Heh, having multiple strips would work just fine for the time being (since you already have the relay board).

It would save the hassle of having to purchase a driver board. I am not too familiar with them, since I have not really looked into them (still using fluorescent tubes, so I just use a relay board).

I believe that you need a dimmable LED driver, which is controlled by the PWM on the microcontroller board. There are several threads in this subsection where people have written up sketches specifically for LEDs, so you may want to look in that.
 
#204 ·
So i just ordered 3x 12V pumps and decided to make a auto dosser as the first project.

I believe all i will need is the pumps, arduino board and relays.

If i decided to add the lcd screen would i need to add a sd card or something to store the adjustable variables? also would i need to use the RTC for it to be able to keep time in the event of a power outtage?
 
#205 ·
If i decided to add the lcd screen would i need to add a sd card or something to store the adjustable variables?
You can most likely store all the variables you need in the EEPROM (unless you have an unusually large number of variables to store).

also would i need to use the RTC for it to be able to keep time in the event of a power outtage?
You will need the RTC to store the information for time/date.
 
This is an older thread, you may not receive a response, and could be reviving an old thread. Please consider creating a new thread.
Top