If your repeater battery backups, it is interesting to know if the supply voltage 230V is present on your repeater.
We will use an opto input to which we connect a (former ) Phone power transformer. This type of transformer -based power and control in addition to being available in the drawers , with the advantage of also do not radiate as may be the case for small block of switching power supply. Its charge voltage is indicated on its label 3.7V . When empty, the voltmeter shows 9 V.
{{ :fr:transfo_nokia.png?300 |}}
==== Connection ====
The connection must be made with :
- JP16 open ( no jumper in place )
- Place a resistor R33
- In connection Pin 2 + transformer block, and Pin Pin 9 or 10 - the block.
{{ :fr:schema_presence_secteur.png?500 |}}
The resistor R33 installation of 1 kW allows a consumer 6mA on the input of the optocoupler .
==== Alert code ====
We chose to alert the user to the loss 220V power supply by changing the tone of the micro released ( roger beep repeater ) .
This code must be placed in the '' rgr_sound '' . When the power source is loss, the input '' GPIO24 '' is low (0)' . At that time , the usual beep is replaced by an ambulance tone ( in France 3 tones : 420 Hz, 516 Hz, 420 Hz).
sudo nano /usr/share/svxlink/events.d/local/Logic.tcl
#
# Executed when the squelch just have closed and the RGR_SOUND_DELAY timer has
# expired.
#
proc send_rgr_sound {} {
variable sql_rx_id;
#Test input on GPIO24 , J26 low voltage between pins 2 & 10, Jumper J16 open
if { [file exists /sys/class/gpio/gpio24/value] } {
set fd [open "/sys/class/gpio/gpio24/value" "r"]
set absence_secteur [read $fd]
if {$absence_secteur == "1"} {
#No power( "Ambulance" tone)
#playTone Hz Vol Duration
playTone 420 700 100;
playTone 516 700 100;
playTone 420 700 100;
set rgr 1;
}
}
if {$rgr == 0 } {
#playTone 440 200 100;
CW::setCpm 100;
CW::setPitch 1000;
CW::setAmplitude 700;
CW::play "K"
}
#playTone 440 500 100;
#playSilence 200;
#for {set i 0} {$i < $sql_rx_id} {incr i 1} {
# playTone 880 500 50;
# playSilence 50;
#}
playSilence 100;
}
Curiously, despite the fixed output voltage of CNY74 , test Raspberry Pi returns the value ' 1 ' instead of ' ' 0 '' when lon reads the value of gpio24 . (''cat /sys/class/gpio/gpio24/value'').
Tests with the external library '' gpio '' are to be programmed.