| The Free Site | vBuddy - make friends, share photos, blogs, have fun | Cheap Web Hosting - starting at $5 |
315 Mhz Solar Powered Radio Repeater
This circuit is the basis of a wireless mesh where signals from any unit can be sent to any other unit and also to a PC, the internet etc. The circuit can be easily modified to act as a sensor or a device that turns on other devices such as pumps or lights.
The circuit consists of two parts - a solar power regulator and a radio repeater. The solar power regulator ends up being quite a complex task to solve as the unit needs to operate 24 hours a day. Overcharging a battery considerably shortens its life, and undercharging means the battery would go flat at night. The solution is to monitor the battery current charge and drain and to charge at a high rate for a defined period of time. The radio transmitter needs 9V and a 9-12V solar panel (30-36 cells) is expensive, so a single battery is used with 4-6 solar cells and the voltage is stepped up to 9V. This circuit has the advantage over multiple cell batteries in that it never will reverse charge a battery. The solar power supply draws inspiration from the circuitry used in solar garden lights and from an excellent article in Talking Electronics http://www.talkingelectronics.com/projects/PowerSupply5vSolar/PowerSupply5vSolar.html
Solar panels are available at excellent prices from http://www.plastecs.com
The radio repeater listens for signals, does some checksums and checks if the message is for this particular unit or is for another unit. If it is for this unit, it acts on the message. If it is for another unit, it waits a random delay and forwards on the message. Each packet has a unique random header and each unit only passes the packet on once. Thus the packet can take multiple paths through the wireless mesh. The mesh is fault tolerant to individual nodes being removed.


How it works: Pad 1 and 2 are the connection to the solar cells. Cells of at least 400mA are needed, and 1A ones work even better as they give a reasonable charge even in cloudy conditions. D1/R1 provide a trickle charge in case the battery has gone flat. Once the battery voltage rises to 0.8V, the transformer will be stepping this up to 5V and the circuit turns on. Picaxe 1 measures the current into and out of the battery and turns on the 5V latching relay which directly connects the solar cells to the battery. When the battery is charged, the solar cells are disconnected. C1 stores enough energy for a 1W burst of RF transmission of about 100ms.
The radio modules are from e-madeinchn (stores on ebay http://stores.ebay.com/e-MadeinCHN) and have a range of very competitively priced modules. The modules used are the 4000m modules, which probably do have a range of 4000m with a clear line of sight and are thus able to cope with going through trees and over hills.
Notes regarding all the clever things to get this working:
1) T2 must be BC337 or higher power. BC547s died after a few days - possibly due to back emf voltages.
2) R10/11 and C4/5 provide a low pass filter for the picaxe to measure the voltages. Without the filter the high frequency current draw from the stepup converter gave very random readings.
3) C2 needs to be at least 470uF to stop resets when the relay changes contacts. The code has also been written to cope with resets, which sometimes also happen from the strong RF signals.
4) All sorts of transistors were tried before settling on a latching relay. All had problems with reverse leakage at night. A latching relay only consumes power when it changes, which in this case is generally once in the morning when it turns on and once later in the day to turn off.
5) Current draw from the battery is 50mA, which equates to 5mA at 10V. The 5V regulator is an ultra low quiescent current LM2936, as standard 78L05 devices consume 3mA which equates to another 30mA from the battery.
6) The battery is a 2500mAH NiMH. Tests were originally done with a 700mAH battery but these went flat after only one night (50mA draw for 14 hours in winter).
7) For debugging purposes, pin0 of IC1 can send data back to a PC, and it does cause slight relay chatter but this causes no ill effects other than to consume a bit more battery power.
8) 6 solar cells for about 300-500mA were used. Theory suggests 4 cells would work as 4 cells are used in solar garden lights. However, in very cloudy conditions a solar cell does not produce 0.45V but rather only about 0.3V at much lower than rated currents. The solar cell surface area is 470cm^2 or 75 inches^2. The glass was bought from a $2 shop for $2 x2 - A4 sized picture frames.
9) The input current values are multiplied by 0.8 compared with the output current to allow for inefficiencies in the NiMH charging process. Even this may be optimistic - some quoted values on the internet only give 66% efficiency. This is a tradeoff between overcharging the battery and shortening its life, vs underestimating the charge needed and having the battery go flat on some nights.
10) 1000m modules work up to about 200 metres with trees etc. Numerous experiments have been done with the 4000m modules including adding 0.047 supercaps to keep the volts stable while transmitting, but the conclusion is that it is not possible to use these modules in this circuit. 4000m modules need a battery 9V supply and this will be the next thing to work on. The 1000m modules do not need supercaps - the 4700uF cap is enough to power a transmission packet as long as there is 10 seconds afterwards to recharge.
11) For debugging it helps to have a simple battery powered Tx and Rx unit. Several things have been found to affect the range greatly (a) the clear space distance around the Tx and Rx unit needs to be at least 2 metres especially metal (b) the units work much better if they are over 2 metres above the ground (c) The signal output must have an equal number of 0s and 1s and (d) The transmitter unit works a huge amount better if it is on at least 1 metre of wire away from the main board. I have no idea why (d) is true but mounting the unit on the board gives a range of about 10 metres and with 1 metre of wire (Gnd, Tx and 9V) the range is 200 metres. Perhaps these wires act as a ground plane, or perhaps they are even acting as an antenna.

Solar panel 3 volts at 300mA made of recycled broken solar cells matched for size
Code for battery management picaxe:
' mAh calcs - 700mAh battery is 700*60 = 42000 mAminutes
' every minute - add the charge current to the counter
' when it reaches 42000+10% ie 47000, turn off the charge and (really important) reset
counter to 42000
'**** New calcs for 2500mAh battery - using the above calcs goes over 65535, so divide all
values by 10
' ie if charging at 200mA then add 20 onto the w6 charge counter
' the 2500mAH battery in minutes is 2500*60=150,000 and with the new numbers this becomes
15,000
' when reaches 15000 then subract 2000 to allow for charge losses
' then turn on charge and charge up to 47000 again.
' if it is supposed to be charging and is <10mA then concludes that must be nighttime
and turns off
' the charge relay for 1 hour (and subtracts appropriate mAH from total).
'start:w6=4000' assume some charge NO- deleted. Sometimes resets but if it does, registers
tend to remain
' so if it resets then at least keep current value in w6. The first loop through on the
very first real start
' sets to 0 and then addsubtract will set to 500
start:debug
main: b8 = 1 ' turn on latching relay so charging
GoSub latchrelay
pause 2000 ' start delay so doesn't get stuck in sleep when reprogram
Do
GoSub addsubtractcharge ' pauses a minute as well
If w0 < w1 Then
' is discharging when supposed to be charging so must be night
b8 = 0
GoSub latchrelay ' relay off
For b9 = 1 To 60 ' wait n minutes. Set to 60 perhaps. Subtract current consumption each
minute
GoSub addsubtractcharge
Next
b8 = 1
GoSub latchrelay ' relay on
End If
if w6>15000 then exit ' all charged up
Loop
b8 = 0
GoSub latchrelay ' relay off
Do
GoSub addsubtractcharge
if w6<13000 then exit' discharged a bit so now try to recharge, keeps a big reserve
this way
Loop
GoTo main
latchrelay: ' if b8=1 then on otherwise off
pause 1000
If b8 = 0 Then
high 4
pause 100
low 4
Else
high 0
pause 100
low 0
End If
pause 1000 ' so doesn't do it too quickly and reset
Return
addsubtractcharge:
disablebod ' power down for a minute
sleep 22 ' 50.6 seconds
enablebod
pause 9000 ' stabilise new current draw
readadc10 1, w0
readadc10 2, w1 ' when charging w0 is > w1 - also w1 is the battery volts
If w0 > w1 Then
w2 = w0 - w1 ' charging
Else
w2 = w1 - w0 ' discharging
End If
w2 = w2 * 49
w2 = w2 / 10 ' value in w2 now is mA current eg 20 = 20mA
If w6 < 500 Then
w6 = 500 ' traps errors where starts at 0 and subtracts 1 and goes to 65535
End If
If w6 > 60000 Then
w6 = 500 ' another error check
End If
w3 = w2 ' for displaying real current directly
If w0 > w1 Then ' charging
'if charging then multiply the current by 0.8 to allow for inneficiency of charge
w2 = w2 * 8
w2 = w2 / 10
End If
w2 = w2 / 10 ' so doesn't overflow w6 all values are 1/10th
If w0 > w1 Then
w6 = w6 + w2 ' add to current charge value
Else
w6 = w6 - w2 ' subtract from current charge value
End If
If w1 < 224 Then ' 1.1V ie 224*5/1024=1.1
w2 = 500 ' battery is flat so start from this position
End If
'debug
'GoSub latchrelay ' delete this in working version - simply puts relay back after debug
Return
Code for Radio Repeater Picaxe
symbol myidnumber = 5 ' change for each device *******************
IMPORTANT **********
' led on pin0 Tx on pin 0, input on pin4
main: low 0 ' tx signal
serin 4, N2400, ("TW"), b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, b10, b11, b12,
b13
' T and W = ascii &H54 and &H57 = 0100 and 0111 = equal 1s and 0s
'b0=random number
'b1=random number
'b2=to device
'b3=reverse
'b4=messagetype
'b5=reverse
'b6/b7 = data 1 and reverse
'b8,b9 = data 2
'b10,b11 = data 3
'b12,b13 = data 4
b13 = 255 - b13
If b12 <> b13 Then GoTo main ' simple checksum on this byte
If b2 = myidnumber Then GoTo messageforme
GoTo transmit ' send it on to other units
transmit: poke 84, b2 ' temp store for b2 and b3
poke 85, b3
peek 82, b2 ' get last id number
peek 83, b3
If w0 = w1 Then GoTo main ' don't retransmit as already done it
peek 80, b2 ' get last random delay
peek 81, b3 ' reload last w5 otherwise random doesn't change
random w1
poke 80, b2
poke 81, b3
w1 = w1 / 3000 ' 0 to 20
w1 = w1 + 1 ' 1 to 21
w1 = w1 * 300 ' 300 to 6300 in steps of 300 ie 0.3 to 6 second delay in 0.3 second steps
pause w1 ' pause random amount of time 0- 6.35 seconds
peek 84, b2 ' get the real b2 and b3 back
peek 85, b3
b3 = 255 - b2 ' redo the inverses as pings etc might reset them
b5 = 255 - b4
b7 = 255 - b6
b9 = 255 - b8
b11 = 255 - b10
b13 = 255 - b12
serout 0,N2400,("UUUUUUUUUUUUUTW",b0,b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13)
poke 82, b0 ' store this id number
poke 83, b1
GoTo main
messageforme: ' action the values in b4-7
If b4 = 126 Then GoTo ping
' anything else ' action the values - insert code here
GoTo main
ping: ' message came from device number in b6 (usually the PC which is radio device 1), so
send message back to this device
Let b2 = b6 ' send a pong back to this device
b4 = 0 'pong code?
b6 = myidnumber
b8 = 65 ' abc
b10 = 66
b12 = 67
peek 80, b0 ' get previous random number otherwise doesn't reseed
peek 81, b1
random w0 ' generate a new id number as this is now a new message
poke 80, b0
poke 81, b1
pause 30000 ' let network settle and recharge the transmitter capacitor
GoTo transmit
********************************* New Long Range Design October 2007 ******************
The above all works but it only has a range of about 60 metres. In order to boost the range the e-MadeInChn 4000m units have been used and these are giving a range of about 200m through trees. However, the current draw is 200mA at 10V and the capacitors are getting unwieldy so it is easier to use batteries rather than capacitors. This has greatly simplified the schematic and if the solar panels are sized so that the charge rate does not result in overcharging then a charge control picaxe is not needed. I used some 4.5V 50mA units available on ebay for $4 each (search for 4.5V solar) and 3 of these gives 27 cells in series or 13.5V charging into 10V of batteries (with a 0.6V diode drop). The picaxe code is being modified slightly from the above as it is using pin 3 as an input instead of pin4 and is sampling the battery volts and transmitting these. Final code will have a sleep routine if the batteries are going flat (better to sleep than reverse charge a cell).
