Le Net du Kermeur
Solar panel interface

 

This interface allows to control remotely the solar panel system powering the wireless backbone. The interface provide several measures, and can do some drive too (like starting fans ...). It talks with one of the wireless backbone router.

This article was first posted on the this page on the "Net du Kermeur" website

Since March 2013, a newer interface, based on Arduino, is now in use in our network.


Hardware

Board with an ATMEGA8535 and a 4 relays board (both bought from Futurlec).


Power used on 5V : ~100mA + 30mA per activated relay; 220mA maximum

Functionalities

8 measures points, 4 used for internal use : input power supply, usage supply, 5V powering the logical circuit, temperature measure.
The power usage can be calculated by : ( input power supply - usage supply ) / value of the shunt.

8 Input/Output with 4 used for the relays board.
The 4 relays are used for : 2 for the unballasting of power use, 1 fan driving (when the temperature is too hot), 1 free

The internal clock can be used for command duration or waiting; it will allow to run some stuff at a given time in the next version of the software. The precision isn't very high, the clock need to be re-sync quite often (cf DATE command).

The external interface is a serial connexion : 19200 bauds 8N1, connected to the wireless router (Mikrotik RB433)
picture

LNDK_AVR Program

Program sources for Atmega8535 (GCC/AVR).

Commands

The invite looks like this: "-->". This show the interface is ready to receive a new command. If it doesn't show at the terminal launch, simply enter a cariage return to force the banner display. Commands are case insensitive.

If everything is ok, the command will return a OK, else it return an ERR.

HELP

Due to memory issues, the help isn't integrated anymore, but return this page URL.

VERSION

Return the version of the ATMEGA8535 software (now AVR004 version 0.01).

DEBUG

Switch to the verbose ouput mode

DATE [OFFSET]

Return the date
The system's date must be set before, or it's return the uptime.
Setting the date is done with the DATE nnnnn, where nnnnn is the time in seconds since 01/01/1970 (epoc).

UPTIME

Return the system uptime.

TESTLED

Use the pin 1 of the port B to blink a led with a rate of 1 beat by second. When serial connexion occurs, the blinking speed change.
The LED/PBO jumper need to be on LED position.
This provide a way to check the program is still running and the serial transfert, but of course use a IO.
re-run the command to stop the test.

PORTB 1..8 [ON-OFF [DUREE]]

Toggle the state of the PORTB 1-8 output.
Warning: The OFF state is used for the 0V ouput (active state), ON 5V.

PORTBS

Show the state of PORTB ouputs 1-8.

MODEB [nn]

Show or modify the mode of the port 1-4. By default, they are used in input mode, set to 1 to force in output mode.

RELAIS 1..4 [ON-OFF [DUREE]]

This is for the commands on PORTB 5-8 ON-OFF [TIME]; this ports are used internaly by the relays board.
The ON state is used for the active state of the relay (!= the PORT command)

ADCA 1..8

Analogue conversion on the PORTA 1-8.

ADCAS

Same a ADCA, but return  the list of values for all pins.

WATCH [ nnn Commande | OFF ]

        Run a command RELAIS or PORTS if no command was received during nnn seconds, example:
                WATCH 600 RELAIS 1 ON 10   
                Will activate the relay 1 during 10 second if the system doesn't receive valid command during 10 minutes.
WATCH OFF
Stop the watchdog.

Communication example

  ----------------------------------------
LNDK_AVR006v0.01 11/2007
----------------------------------------
-> date
Date 2008-05-21 20h 27m 33s
OK
-> uptime
Uptime 118j 6h 53m 02s
OK
-> adcas
ADC 1 : 1
ADC 2 : 0
ADC 3 : 0
ADC 4 : 1
ADC 5 : 533
ADC 6 : 520
ADC 7 : 508
ADC 8 : 291
OK
-> dummy
ERR
 


Terminal Emulation

Of course you need a serial port and a serial connexion software to talk with the system (RS232)
Here a short list
OS Program Notes
Linux, *BSD minicom Automatisation with option --script, example
MacOsX ZTerm + serial adaptor on Mac
Openwrt microcom (script possible) + package setserial (and MAX232 interface on the WRT54GL)
RouterOS /system serial-terminal serial0 (no script) From a RouterOS(winbox, ssh, etc ...) console 
Automatisation with Perl Expect module
Telnet on serveur RFC2217 (cf /port remote...) From a remote host, script Perl Net::Telnet
Windows Hyperterminal  


Hardware integration


The ATMEGA8535 board and the relays board go on a dead Linksys WRT54GL PCB. We remove most stuff from the WRT PCB except the regulated power supply.

The wan port is used for the serial connexion (cisco wire mode)

Ethernet ports 1 and 2:
        4 ADC inputs (1-4)
        The input from 5 to 8 are used internaly : battery, usage supply, 5V measure and temperature.

Ethernet ports 3 and 4:
        4 I/O ports (1-4)
        The ports 5-8 are connected to relay board internaly. (driving about 5A / 250V or 10A  / 24V)


The whole system



We can see the solar panels, the case for the battery (white), the case with the solar panel regulator,
the interface described here and a Mikrotik router, 1 patch antennas, and a directionnal SD19.

Cacti Integration


Author : Marc Dilasser, September 2007, mail : md AT lekermeur.net