I made great progress on the USB control board. Here is a picture of a prototype:
I am using an AStar 32U4 micro, from Pololu as a USB interface. Indeed, i planed to use a bare ATMega328p, but this was cheap (aprox 5$ during black friday), while being compact and retaining most of the functionalities of a regular arduino. Since it was so cheap, i decided to use it rather than a circuit based on a Atmega328p with wires for serial communications going to the serial port of the Raspberry pi. It enables the user to use this device with whatever computer, provided that it has drivers for USB-serial.
I chose this model because it was cheap, and i had a few laying around, but any arduino will do.
Anyway, this little board has GPIOs connected to two relays, two (perhaps 3, later on) TIP120 transistors, 3 DS18B20 temperature sensors (one regular, two waterproof). The relays are intended to control mains current. The first TIP120 is there to control strips of LED through PWM. A second TIP120 transistor controls fans used to cool down the water. The third TIP120, if used, will control a TEC unit, used to further chill down the water.
The temperature sensors are there to monitor the water temperature, and the air temperature. I have two tanks, so at first i'll monitor both tanks temperatures, but later on, the second water temperature sensor will be used to monitor the water chiller temperature.
As of now, this unit will control both tanks, but later on i want to have one unit per tank.
All of those sensors and effectors are controlled through serial. As of now, i can send various commands to turn on and off the lighting or even fading it in and out. The relays are simply switched on or off, and their state can be monitored over the serial port (you send "getRelay1Status", and get "on" or "off" in return). The extra transistors will be controlled via PWM, and thus the duty cycle will be set through serial. Again, the status of each transistor can be probed. At last, each temperature sensor can be probed via serial (you send getWaterTemp1, and get the first waterproof sensor's reading).
I have mostly written the code on the Astar, then i'll write programs to send serial commands to the device.
I also plan to add in the protocol a way to set some settings, such as the temperature at which the fans will start, etc.
I am considering adding an RTC clock, so that the device can handle turning the lights on and off automatically, without a master controller. If so, the device could be plugged into a computer to set it up once, then run autonomously. I however want to log data, and have a web interface to review and control the system, so i'll connect it to a raspberry pi anyway. However, i could instead use an ESP8266 for wifi connection.
For now, no physical interface is visible on the device, because i want the buttons, LCD, etc, to be connected to the Raspberry pi (or computer connected to the device).
See you next!