The as-of-yet Un-named, Teensy3.0 Aquarium controller build

AndyL

New member
Well, figure I'll post this here... So I have future reference of my insanity...

A little fishkeeper who's recently gotten mobile, made me realize I need to rejig my aquarium controllers... He has a love of all that is LCD and buttons.

Luckily I was running standard heaters, set to 85f - not the 168f he managed to dial in :) So other than a brief warm-up, and a flashy LCD backlight showing an out of range condition; no damage.

That said - its time to upgrade 3 tanks with new electronics, where we can omit the local controls. (Harder for a 15month old to unlock a cellphone/tablet, open a webpage, and reconfigure things). My tanks are salt and freshwater, so we're going to make a few compromises to keep things non-application specific.

One of the goals here is to keep this project CHEAP.

So, the choices of controllers are much more varied of late... I kind of want to step away from the arduino truth be told. ARM adds options not available in arduino, and increases some headaches...

The obvious choice was the beaglebone black. Unfortunately my original beaglebone had nothing but issues; a friend at the hackerspace - just RMA'd his black for a 3rd time... So ... Not the beaglebone. Pi's awesome - but are a royal pain to get IO's.

Kinda brought me back to the other reliable ARM MCU...

Teensy 3.0 https://solarbotics.com/product/52060/
Specifications

MK20DX128 32 bit ARM Cortex-M4 48 MHz
128K Flash Memory
16K RAM Memory
2K EEPROM Memory
I/O - 34, 3.3 Volt
12 Analog inputs
10 PWM outputs
8 Timers (isolated from the PWM)
USB with dedicated DMA memory transfer
3 UART serial ports,
1 I2C
1 SPI
1 I2S
1 IR modulator
Real Time Clock (add your own 32.768MHz crystal & battery)
4 general purpose DMA channels separate from USB DMA
Touch sensor inputs
And... 20$ Who can argue with 20$? Note - it has a real time clock on-board, just need to add crystal/battery. So no additional 10-20$ for the 1307 RTC shield/plug-in/circuit.

Started with the pH circuit. Now the one glitch with the Teensy is the 3.3v logic. My gripe with most of the circuits I've used for pH measurement was the funky voltages, and ranges... So I headed down to the hackerspace and talked to my buddy dan - who's a genius with these analog circuits... Handed him this http://blea.ch/wiki/images/2/24/PH-sch.jpg and asked if we could make this run off 5v and output 3.3v logic - without going into a negative voltage output.

Basically a single OPA2349 to replace the TL062's - same configuration, a minor revision with a voltage divider at J1, and we're set to go. Yes it's a surface mount component... Luckily it's a big surface mount component :) Total cost of the pH circuit? <8$

The rest is pretty easy peasy - we've done this before, only glitch is making sure you order 3.3v compatible components... Those cheap ebay 25amp SSR's - seem to work down to 2.5v (from testing) claim 3 - so 3.3v shouldn't be an issue. Local i2c LCD's and keypads are possible for those who want them. As usual the DS18B20's will be used for temperature. There's some minimal changes as we convert a few pieces over to 3.3v, but it's all pretty standard.

PWM dimming for LEDs, implements almost identically to the arduino controllers, I've got a project coming up in mind for this, but it'll be after the main controller is done.

As far as the web interface - I'm going in a totally different direction...

The 3.3/5v compatible SDcard readers on ebay are about 2$ We've seen these used before...

But how does that solve our web interface?

http://hackaday.com/2013/08/12/hacking-transcend-wifi-sd-cards/

So these "Wifi enabled" SD cards - are small standalone ARM powered linux devices :) 90% of them are easily hacked - appear to all have similar 'failures' in the security department. So basically we just need to reconfigure the web-server to serve the webpages we want... Best part - you can get one for about 30$

For me 99% will be monitoring, but I'm sure its possible to have the web interface drop a configuration file onto the Fat32 volume, and have the teensy assimilate that into the program.

Nice part here is - the handling of the web interface - is off the MCU, so the teensy remains a dedicated controller - if the web's hacked / goes haywire - the MCU is still independent - and shouldn't suffer if the ethernet fails.

Programming side - I'm going to struggle with... Quickly asked D0ughb0y for permission (and it was granted) to steal/butcher his code used on http://www.reefcentral.com/forums/showthread.php?t=2332822 the Neptune Apex, Once I've got some hardware breadboarded, I'll start seeing how badly I can butcher his code :)

Hoping to have some pics and schematics up in the next couple weeks, this time I'm going to test first before posting :) And still waiting on a bunch of slow boats from china at the moment...

Questions/Comments/Suggestions/Missing features??? Speak up! :D

Andy
 
Hey Andy,
This may be of interest to you (Wifi SD card):
https://www.youtube.com/watch?v=-Z9TrZQw16s
Your suggestion about running a webserver using the wifi sd card is interesting.:cool:

Also, I am guessing that in the long run you will add more sensors, most probably on i2C port, so you should take a look at I2C port expanders, then usually come in 8 or 16 channel ICs, that allow you to add 8 or 16 extra devices along the same 2 wires coming out of the Teensy SCL & SDA pins.

I am also working with Teensy 3.1, and am in the process of figuring out all the sensors I will need for my tank (all the things I want to monitor), and anything I want to control (LEDs & Jebao WP10 pumps).

I have my eC (Salinity) & pH circuits, but I need to do my homework, as I also have a TMP102 measuring the ambient room temperature. So you can see I am starting to run out of I2C pins to connect more sensors. Most micro-controller cards usually come with only 1 or 2 ports.

It would be interesting to know how you get on with this.
 
odd the beaglebone is having issues. I started my own contoller project with the beaglebone black and it runs great (so far). The number of IO's is awesome.
 
Hi vpaul79, how many i2c devices are you running?

I was looking at BBB yesterday, it seems to be a nice board. Have you seen the Adafruit webide, they have just updated it for the BeagleBone? It is pretty awesome
 
Hi vpaul79, how many i2c devices are you running?

I was looking at BBB yesterday, it seems to be a nice board. Have you seen the Adafruit webide, they have just updated it for the BeagleBone? It is pretty awesome

I'm not running any as of now. I want to hammer out the software first as my project is in its early stages. Right now I'm trying to get 3v3 logic to handle 5v devices. My first task it to make a controllable power. So I got 8 mechanical switches that need 5v logic, so I have to convert it, but the converter needs its own 5v source. So I got a micro transformer that takes main power and converts it to a 1A 5v power. Now I can get everything put in a project box and just need to send the logic signal. After I get that going I will work on the LED logic and then an interface. Although for the time being I have used a Java app running on the Linux desktop that I VNC into from my laptop, so I dont need a LCD screen yet.
 
I read somewhere that some of the relays/SSR specifiy 5v trigger, but also work with 3.3v.
It is worth checking out, as it may save you some hassle. Also Solid State Relay SSR maybe better as you don't get the clicking sound every time you switch it on/off.
There are a lot of step up/step down dc converters, and also bi-directional 3.3 & 5v logic level converters, available.

I currently have a Teensy 3.1 & a Udoo Quad, & Radxa Rock dev board, but I am looking at BBB and others; It is quite interesting trying to get the 'Perfect Setup'.
 
I like this project, DIY neptune is all you need really, The app is beautiful and at the moment it really does provide all the necessary programability that makes it perfect.....
But my only real question is why not just go for Iboard pro? At the end of the day these are all just development platforms, and really you don't want that it just means having a birdsnest with random wires falling out in the middle of the night because of the ghosts in your house.
you want something like the actually neptune, at least the Iboard pro gives every one a basically one board solution.

I don't mean to hijack your thread, But there seems to be alot of demand for a good open source solution, and teensy 3.0 is a great dev bed but why is it better then the mega? Arm introduces problems with library support and heaps of nightmares.

If you wanted to do something really sick an open source arm based controller with on board connectors for everything (I2C, 1wire, pH, EC, ORP, Few analogs for some relays) would kill it, think Arduarium Controller (www.practicalmaker.com/projects/arduarium-controller) but with onboard MCU , Its really sad that Arduarium never really made it big and everyone just used atlas for there builds, his macroduino was actually quite similar to the functionality you can achieve with apex (obviously apex is eleventy times better)


In conclusion taking the Arduarium Controller board files and madfellaering in a 2560 would ultimately be a far more beneficial project, then porting code to a better platform.......
 
vpaul79, what type of system are you building? are you controlling pumps & LEDs, or monitoring temperature, salinity, PH etc...?
 
Im running an original beaglebone as my controller so far... 2 i2c devices on it, 1 wire in the kernel, $10 wifi dongle and a full LAMP server basically. Its running 3.8 kernel with ubuntu.

Right now its monitoring temps, but not recording data (i don't really know how/what/where i want to store it). Its controlling my lights and giving me a fun interface to program the ramps in. This is 10 channels of pwm, which i offloaded from the BB to a pwm board and connect to via i2c.
fancierLighting.png~original


I also have the ability to flip some relays, but its not interfaced with anything yet, and goes unused. I have a test program that i can manually run so i know it works. Also accessed via i2c. My latest addition to the project is a motor controller for dosing pumps. Its just a chip that i can toggle 4 motors with that works down to BB logic voltages yet can provide the voltage/current i need. Have to mount some dosing pumps and test it soon, though it should work =D.

The project has not been smooth by any means... some parts just work, but many do not and i have to learn entirely new things to fix it. Like compiling the kernel, to compile a driver and fixing wifi; instead of just plugging it in like it should. Also have basically no web experience or database knowledge... Currently my 'data' is just text files (json files really) and is probably not the smartest thing, but it works for now.
 
@Gorgok - Sounds like you have got quite far with your project. How many I2C devices can you have in total on the BB?
How did you do the web interface, was it difficult?

I just noticed that the Teensy 3.1 is down to $17 +$2 worldwide shipping.
http://store.oshpark.com/products/teensy-3-1 I just ordered 2 so that I can have one running on my tank, and another for me to experiment with on my desk.
Lots of this stuff is entirely new to me too, so it is good to have a backup, in case i burn it up.
 
i2c is limited by addresses, and those are often set by the chip manufacturer... If you have no devices that share the same address you can have quite a few devices hooked up. I believe the range is from 0x03 to 0x77 so 117 addresses. I know on the BB there are 3 i2c busses (2 +1 that needs a kernel recompile to show), but even on the one im using all but 4 addresses are available in the default configuration. The devices i have hooked up have the ability to change address on the board, so i could have multiples of both of them. Some devices, however, have no such option and if you want more than one of those you have to have the devices on separate busses. Its not really a question of a limit on the BB really, just devices compatibly with each other.

To make that display/input thingy i used jquery and an extension called jqplot. Using lots of google and trial and error i got it to do what i expected it to most of the time. There is lots of javascript on that page to handle all sort of stuff that i should probably move of to their own files and import, but once stuff works (or appears to) motivation for continued refinement drops off. I have planned to use that plot thingy for its real purpose and display temperature (and possibly PH later) but i haven't gotten a handle on temperature data storage, so i haven't made the display page either. I can't be any harder than using a plot as input and output though =D.
 
Hey! I'm the guy who originally got started with the Arduarium project. I figured since I finally got a really nice tank it's time to get back to the forums lol.

Have you taken a look at the Spark core (spark.io)? I myself am moving away from the Arduino route because they don't have enough power.

The nice thing about the spark core is it's got wifi onboard already and you can make a web based frontend that will hook into it. It's a really nice piece of kit. It's the cheapest route I've found so far to add some serious power along with wifi to a project.

Also, the pcDuino v2 has wifi onboard. It's more powerful than the rpi, but it's got analog inputs (3.3v as well), i2c etc. etc.
 
Hello Andrew,
I got my Spark core ($40) on order, arriving mid April (delayed) with the relay shield ($20).
I considered the pcDuino v2, but it looks a little big.
While waiting for the Spark Core I ordered two more Teensy 3.1 from oshpark ($17 each), and some HC-05 bluetooth modules for (£4.50), so I can probably try some wireless sensors sending TX serial to the Spark Core via bluetooth.
I like the Teensy platform because it has the power of ARM proc, but still compatible with Arduino code, and is REALLY tiny. I read some where that they will be releasing more Teensy3 products later this year, so hopefully that might include onboard WIFI.

I am also watching https://pinocc.io/ as mesh networking is built in to it.

The one that I am really interested in is http://micropython.org/ this one could be a game changer, with optimised python.

It would be cool to know your thoughts on these?
 
Last edited:
Back
Top