Stilo Documentation v3 - 0
Stilo Documentation v3 - 0
ver. 3.0
• Updated the sketch and libraries to be compatible with Arduino IDE 1.0;
• Increased LED channels number to 5;
• The number of LED channels displayed and controlled can be changed in
settings;
• Added moonlight channel;
• Added ATO with one floating switch;
• Rewrote the code to remove buggy String objects;
• Changed the way temp sensors are addressed;
• Added screen brightness adjustment;
• Added LEDs color mixer screen;
• The display automatically gets back to main screen after 10 min of user
inactivity.
v.2.5
• Updated to latest ITDB02_Graph16 library that support more screen types;
• LEDs output is set in percent (not 0-255 values);
• Some general visual changes;
• Added configuration of LED fans temperatures;
• Safety feature - dimming LEDs if heatsink is too hot;
• Can restore settings on start or by option in menu;
• Temperature alarm can be acknowledged to turn off buzzer;
• Removed control of heater and cooler;
• Added 25kHz signal to control LEDs heatsink fans speed.
v. 2.1
• Water temperature sensor changed to digital DS18B20;
• Pins to control water heater, cooler and for alarm buzzer;
• Led heatsink temperature sensor (DS18B20);
• Speed control for heatsink fans;
• Led values can be changed from menu;
• Setting can be stored in EEPROM.
v. 1.5
• Minor changes to design;
• Added temperature probe and temperature control page;
• Tidied up the code.
The pins on different screens may vary but descriptions should be very similar.
PARTS
LCD screen – the screen is 320*240 pixels, 3.2'' TFT LCD module and must have
one of following controllers (and working with 16-bit interface):
− HX8347-A
− ILI9325D
− ILI9327
− SSD1289
and ADS7843 compatible touch panel controller.
I bought mine on ebay but they are available from number of online shops
including http://iteadstudio.com/store, http://www.elecfreaks.com/store and
others.
The backlight pin can be connected to 5V through transistor (standard BC549C
should be enough) what allows to control LCD brightness via PWM signal from
Arduino pin 10. If LCD brightness adjustment is not required then backlight pin
can be connected directly to 5V through resistor. Its value will determine LCD
brightness and should be more then 56 Ohms.
Proto shield for Arduino Mega to put all components together. I have made one
myself from generic proto board but dedicated proto boards are available from
many shops.
Also available are special shields for the LCD screens. They have all components
and connectors that allow for the screen to be easily connected to Arduino. Very
often they comes with RTC clock build in but they are not suitable for soldering
more components so a proto board is still needed. All boards are then stacked on
top of each other.
I have decided not to use LCD shield and put all components on one proto board.
What you can't see on the picture is Arduino itself which is connected
underneath my proto board.
RTC (real time clock), already assembled or it can be made from parts:
• DS1307 chip
• 32.768kHz Crystal
• CR2032 battery and holder
• 2 x 10kOhm resistors
• 0.1uF capacitor
Heatsink fan (or fans)– PC fan with PWM control, they are recognized by having
4 wires instead of usual three. The fourth wire (usually blue) is used to control
fan speed. The specification says PWM frequency must be between 21-28 kHz so
Stilo is changing the timer on pins 2 and 3 to adjust frequency of PWM signal.
The fans I use are Arctic Cooling 12 PWM AC. They are very quiet but they don’t
turn off at PWM 0%, so I have used transistors controlled by pin 49 to switch
them off.
INSTALATION
I really recommend to buy a proto breadboard and jump wires, they are not very
expensive and they can save a lots of frustration while building and testing
projects.
To start with Stilo – first copy libraries from zip to appropriate folder – see
http://arduino.cc/en/Guide/Libraries for details.
Next thing is to make screen running - connect it to Mega board (i.e. using
breadboard). The screen has 40-pin connector so I used ATA cable (40-wire, old
type). Data pins are connected through 12k resistors. LCD brightness pin can be
connected to +5V through resistor (the brightness can be adjusted by changing
the resistor value, I have used 82 Ohms) or with transistor that allows to control
brightness by pin 10.
Check if the screen is working by uploading example: File > Examples > UTFT >
Arduino > UTFT_Demo_320x240.
The touch screen - upload touch example File > Examples > UTouch > Arduino >
UTouch_ButtonTest and check if it's working.
Touch screen needs to be calibrated, this is done by running calibration sketch
located in examples and then following on screen instructions.
At this point we can connect RTC to the Arduino and upload Stilo sketch and
check if it displays time and date.
The controller can be used with any LED driver that is PWM dimmable (and will
accept 480Hz signal from Arduino). The most popular are Meanwell and
Buckpucks but there are plenty of others.
LEDs and drivers – I'm not going into much details here as there are many
combinations of LEDs and drivers types. There is plenty of information on the
net, specifically check DIY and lightning sections on all popular marine forums.
Choice of LEDs – another topic I'm not able to cover here. I have started with
(recommended at the time) 50/50 XPE royal blues and HR-E cold whites but soon
discovered (as other people using the same setup) that this combo gives too
washed out effect. Since then I changed some of cold whites for neutral whites
but still I'm not 100% happy with the effect.
There are couple of good threads on marine forums about this topic (search for
'leds aesthetics'). Right now I'm thinking about changing some of royal blues for
cold blues, adding few violet leds and maybe couple of reds for good measure.
Pins settings
Those settings specifies pins on board used for specific parts, change them if
needed:
Sketch settings
Some of the settings below are permanent, they can't be changed after sketch is
uploaded.
1) In the code used to control 25kHz PWM, value 639 represents fans speed
of 100% so 300 is almost 50%. This means that fans will turn on when LEDs
temperature is about half way between HsinkTempMin and HsinkTempMax. In
example here it's 30 and 40 °C so the fans will start at 35 °C with 50%
speed and stop at 30 °C. I found the fans to be very effective and without
this mechanism they kept to turn on and off every few seconds.
// Channel 1 leds output values %:
byte ch1led[96] = {
0, 0, 0, 0, 0, 0, 0, 0, //0 1
0, 0, 0, 0, 0, 0, 0, 0, //2 3
0, 0, 0, 0, 0, 0, 0, 0, //4 5
0, 0, 0, 0, 0, 0, 11, 11, //6 7
11, 11, 11, 12, 12, 13, 13, 14, //8 9
16, 16, 16, 16, 20, 25, 30, 35, //10 11
40, 47, 47, 47, 47, 47, 47, 47, //12 13
47, 47, 47, 47, 47, 47, 47, 47, //14 15
47, 47, 47, 47, 47, 47, 47, 47, //16 17
Those arrays keep LEDs output values for each channel respectively. Each value
is the light output in 15 min intervals. Each line represent 2 hours. So the line:
25, 20, 15, 11, 11, 11, 11, 11, //20 21
gives us 25% output at 20:00, 20% at 20:15, 15% at 20:30 and so on.
The light output is adjusted in 1 min intervals and those values are calculated in
real time based on previous and next value.
Those tables are loaded on start, however they can be overridden if the light
outputs have been previously changed and saved into EEPROM and the option
readEEonStart is on.
OPERATION
Main screen
Main screen displays time and date, LEDs output values, water and heatsink
temperatures, fans speed and moonlight information. The number of bars
displayed depends on number of LEDs channels configured. In the same way
LEDs menu, test screen and color mixer screens depends on configured number
of channels.
Moonlight information includes moon's picture in current phase, moon
illumination and current phase. Moonrise and moonset time is displayed only in
real time mode.
LEDs OUTPUT:
Bring us next menu to choose one of color channels or moonlight settings.
Number of displayed channel options depends on configured number of
channels.
Moonlight:
Moonlight can work in two modes: simple and real time.
In simple mode (switch on the top of the screen in OFF position) the moonrise
and moonset times are configured by user in 'Set times if above is OFF' section.
Simply moonlight will be turned on on chosen moonrise time (17:00 on the
screen shot) on turned off on moonset (9:00 am).
If the switch is in ON position moonrise and moonset times are greyed out and
real times mode in on. In this mode moonrise and moonset times are calculated
according to local time and configured latitude and longitude. The next event is
displayed on main screen so if the moon is up the screen will display next
moonset time and if moon is down it will display moonrise time.
The bottom section applies to both modes and it allows to change moonlight
minimum light output (for new moon) and maximum value for full moon. So
during new moon the moonlight doesn't have to off and on full moon it doesn't
have to be 100%. In between the light output is the percent of the value
between min and max, for the example below if on particular day moon is
illuminated in 75% the moon light value will be 75% between 19% and 70% of
maximum LED output.
TEMP. SETTINGS:
If the temperature alarm went off the main screen displays water temperature in
red and 'ALARM' notification and buzzer bips every 5 seconds. Pressing the red
square acknowledges alarm and mutes the buzzer. When the temperature
returns to normal value it is displayed in yellow colour to notify about previous
alarm. Pressing red square acknowledges previous alarms.
If LEDs heatsink temperature was over 'cut off' limit it will be displayed in yellow
colour until acknowledged by pressing red square.
ATO SETTINGS:
Max time determines for how long the ATO pump can safely work (pump top up
water to aquarium). If the pump work for longer (for example float switch is stuck
or there is no water it top up tank) the pump is disabled and 'ATO FAIL' message
appears on main screen.
The pump can be enabled by pressing the on/off switch on this screen.
Stilo:
www.code.gogle.com/p/stilo
http://arduino.cc/forum/index.php/topic,54196.0.html
http://www.thesaltybox.com/forum/tank-mods-diy/127554-led-lights-controller-
tft-lcd-touch-screen.html
LEDs color choice (very long threads, it may be cut to posts from last year or so):
http://www.nano-reef.com/topic/246394-led-aesthetics-what-do-you-really-think-
of-your-color/
http://www.reefcentral.com/forums/showthread.php?t=1885076