jeudi 28 avril 2016

Gys 161 Repair

I had to tear down a Gysmi because one of the screwed crimped connections that hold the two PCBs has been unsticked with the time and the heat probably (3 years use). I had to replace it with a piece of thick wire instead.

Unwelding thePower PCD :
Caution  : Unwell the DIN rack BEFORE unscrewing the heat dissipator. It would destroy the tracks otherwise
Lift first the plastic holder
Fold each pin while melting the solder so you can reach the second rack then. Do the same operation on this second one.
Pull then carefully the pins out from the Power PCB while consequently heating the solder to avoid any track lifting.
Much easier to mount it back.
Before mounting back, if you had to pull out some, spread back the cooling silicon Electrolube SC2003 found in Farnell Elements, because there are smd component that dont have a heat dissipator.

Cdt.

vendredi 12 décembre 2014

En opération


L'eau

Petite installation (3Kw maximum) attaquée par le calcaire.
Décrassage à l'acide et au burin.
Repeinture, graissage.

Hydroelectric Turbine repairing.
Limestone cleaning with acid and axe.
Re painting, greasing.




Vidéo surveillance

Adaptation d'un détecteur PIR sur caméra avec un microcontrôleur ATTiny13.
ATTiny13 Camera PIR control.

Chasse sauvages

Détecteur PIR converti en 24V associé à une cloche (moteur et support de gyrophare).
Efficacité confirmée en test sur sangliers en culture de céréales et oiseaux prédateurs sur fruitiers.

PIR detector linked to a bell to protect crops from wild attac.

mercredi 26 novembre 2014

Détecteur cellulaire.

Petit montage sur AVR ATTiny avec un détecteur PIR.

jeudi 10 avril 2014

Temperature cellular bipper : Atmel Assembler AT tiny45



This circuit when it is called, hangs up and beep according to the ambient temperature.

Because market farmer have to be permanently cautious of the right climate of their green house. This tool has to be cheap according to the poor income that marketgrowing generate.
This is a first first personnal experience on circuit building. From recovering from scratch components, getting to know how µC work, and soldering with a small solar unit.

The first project was made with a sensor recovered from a Petrol heater but I couldn't get a right accurate temperature curve.So I redid the circuit with a sensor included in the chip (ATtiny45).

The ring in is connected to the vibrating motor of the cellular. Because of the low voltage on this last, it is connected to a transistor which pulls the µC pin on the ground on function.


Hang up pin is directly wired though an additionnal push-button so it is still possible to use the keyboard.

Buzzer is activated though a PWM pin  (4,5 Mhz).

The solders are made with a 12v 35 W iron with a 60 W solar panel. Inspite of the power available, it really has to sun shine to do proper solders.
BIps
Température °C
1
~ under 0
2
0 à 6
3
6 à 9
4
9 à 16
5
16 à 20
6
20 à 24
7
24 à 30
8
30 à 35
12
More than de 35°C

/*
 * at45PROJET.asm
 *
 *  Created: 10/03/2014 16:56:44
 *   Author: fg
 */


 ; ********************************************
; * [Add Project title here] *
; * [Add more info on software version here] *
; * (C)20xx by [Add Copyright Info here] *
; ********************************************
;
; Included header file for target AVR type
.NOLIST
.INCLUDE "tn45def.inc" ; Header for ATTINY45
.LIST
;
; ============================================
; H A R D W A R E I N F O R M A T I O N
; ============================================
;
; [Add all hardware information here]

; ============================================
; P O R T S A N D P I N S
; ============================================
;
; [Add names for hardware ports and pins here]
; Format: .EQU Controlportout = PORTA
; .EQU Controlportin = PINA
; .EQU LedOutputPin = PORTA2
;
; ============================================
; C O N S T A N T S T O C H A N G E
; ============================================
;
; [Add all constants here that can be subject
; to change by the user]
; Format: .EQU const = $ABCD
;
; ============================================
; F I X + D E R I V E D C O N S T A N T S
; ============================================
;
; [Add all constants here that are not subject
; to change or calculated from constants]
; Format: .EQU const = $ABCD
;
; ============================================
; R E G I S T E R D E F I N I T I O N S
; ============================================
;
; [Add all register names here, include info on
; all used registers without specific names]
; Format: .DEF rmp = R16
.DEF loop1r = R9
.DEF loop2r = R10
.DEF loop3r = R11                ; Loops registers for 0,5 second timer
.DEF rmp = R16                    ; Multipurpose register
.DEF Result = R17                    ; 20 min Result of Store 1 to 4
.DEF buzzcounter =R18;
.DEF Mesureaverage = R20            ; Average of 4 checks then stored in a Store register
.DEF COUNTER = R21               
.DEF Flags = R23           
.DEF mesure = R24        ; multipurpose counters



;
; ============================================
; S R A M D E F I N I T I O N S
; ============================================
;
.DSEG
.ORG 0X0060
; Format: Label: .BYTE N ; reserve N Bytes from Label:

; ============================================
; R E S E T A N D I N T V E C T O R S
; ============================================
;
.CSEG
.ORG $0000

rjmp Main ; Reset vector
reti ; Int vector 1
rjmp PCINT0INTERRUPT                        ; Triggered when a ring come in
reti ; Int vecTOR 3
rjmp TImerend
reti ; Int vector 5
RETI                ; Large prescaler timer loop interrupt
reti ; Int vector 7
reti ; Int vector 8
reti                        ; A/N conversion end interrupt which wakes-up the µC
;
; ============================================
; I N T E R R U P T S E R V I C E S
; ============================================

PCINT0INTERRUPT :

    ldi mesure, 1
    rcall secondtimer025            ; This routine because the timer didn't work properly in the interrupt
    wdr 
    reti

TImerend :
    ldi flags, 1
    reti                        ; Set timer end flag to follow down the program.

; ============================================
; M A I N P R O G R A M I N I T
; ============================================
;.Avr-Asm-Tutorial 15 http://www.avr-asm-tutorial.net

Main:

; Init stack************************************************************

    LDI rmp, LOW(RAMEND) ; Lower byte
    OUT SPL,rmp ; to stack pointer

; Init Port B Directions************************************************

    ldi rmp, 0b000001 ; Direction of Port B

                    ; 0 = BUZZER
                    ; 1 =
                    ; 2 =
                    ; 3 = rINGIN
                    ; 4 = Hang up set to in because the controller just has to act as a switch the touch to ground.
                    ; 5 = Reset
    out DDRB,rmp



; Init Port B levels******************************************************

     ldi rmp, 0b001110
    out PortB, rmp;  Unused port 1 and 2 Pull-ups enabled 

; Set watchdog timer *****************************************************

    ldi rmp, 1<    out WDTCR, rmp                    ; Watchdog enable
    ldi rmp, (1<    out WDTCR, rmp                    ; Set WDT to 8 s

; Interrup ring

    ldi rmp, 1<    out GIMSK, rmp
    ldi rmp, 1<    out PCMSK, rmp        ; Port 3 interrupt enable


; ============================================
; P R O G R A M
; ============================================


    rcall buzzer
    rcall secondtimer025
    rcall secondtimer025
    ldi rmp, (0<    out TCCR0B, rmp                ; , Beep 0,5 second, off buzzer
   
    rcall secondtimer025
    rcall secondtimer025        ; Wait 0,5 second


; Measure routine ***********************************************************************

Measureroutine :
    ldi rmp, 0
    sei            ;         Enable interrupts

loop :
   
    WDR
    sbrs Mesure, 0
    rjmp loop            ; Wait for ringing in flag setting

    cli

    ldi counter, 4
loopone :
    rcall second
    dec counter
    brne loopone        ; Wait 4 Second to avoid to fast hanging up execution
   
    sbi DDRB, 4    ;
    rcall second
    cbi DDRB, 4            ; Hang up


    ldi counter, 3
looptwo :
    rcall second
    dec counter
    brne looptwo        ; Wait the time the line is on
    wdr                    ;
; First fake conversion to led the AD starting
    ldi rmp, (1<    out ADMUX, rmp
    ldi rmp, (1<    out DIDR0, rmp    ;   AD in disable
    ldi rmp, (0<    out MCUCR, rmp    ;    ADC noise réduction mode
    ldi rmp, (1<    out ADCSRA, rmp ;  Start conversion, interrupt enable
    SEI
    SLEEP ; Wait for done conversion interrupt

    CLI
    in rmp, ADCL
    in rmp, ADCH ; Load out the data to allow new Datas measurement.

    ldi rmp, (1<    out ADMUX, rmp
    ldi rmp, (1<    out DIDR0, rmp    ;   AD in disable
    ldi rmp, (0<    out MCUCR, rmp    ;    ADC noise réduction mode
    ldi rmp, (1<    out ADCSRA, rmp ;  Start conversion, interrupt enable
    SEI
    SLEEP
   

    CLI
    ldi rmp, (0<    out ADMUX, rmp
    ldi rmp, (0<    out MCUCR, rmp    ;   off ADC noise réduction mode
    ldi rmp, (0<    out ADCSRA, rmp ;  Stop conversion,
   
       
    ;  answer************************************************************

ans :

    ldi Result, 0
    ldi buzzcounter,0
    in Result, ADCL
    in rmp, ADCH; Load in High to allow next measurement. This part is not needed because it doesn't change at those temperatures.   
   

    cpi Result, 25
    brmi buzzerone ; Compare with thresholds .
    cpi Result, 30   
    brmi buzzertwo                ; under 6 °c
    cpi Result, 34
    brmi buzzerthree                ; under 9°c
    cpi Result, 42                ;
    brmi buzzerfour            ;  16
    cpi Result, 48
    brmi buzzerfive            ; 20
    cpi Result, 56
    brmi buzzersix            ; 24
    cpi Result, 62
    brmi buzzerseven            ; 30
    cpi Result, 66
    brmi buzzereight

    rjmp  buzzertwelve        ;over  35
   
; Corresponding number of buzzer bip Loading **********************************************************   

buzzerone :
    ldi buzzcounter, 1
    rjmp buzz

buzzertwo :
    ldi buzzcounter, 2
    rjmp buzz

buzzerthree :
    ldi buzzcounter, 3
    rjmp buzz

buzzerfour:
    ldi buzzcounter, 4
    rjmp buzz

buzzerFIVE:
    ldi buzzcounter, 5
    rjmp buzz

buzzerSIX :
    ldi buzzcounter, 6
    rjmp buzz

buzzerSEVEN :
    ldi buzzcounter, 7
    rjmp buzz
buzzereight :
    ldi buzzcounter, 8
    rjmp buzz


buzzertwelve :
    ldi buzzcounter, 12
    rjmp buzz

;buzz *****************************************************************************
    buzz :

    rcall buzzer
    buzzloop :
    WDR
    ldi rmp, (1<    out TCCR0B, rmp                ; on buzzer
    rcall secondtimer025
    ldi rmp, (0<    out TCCR0B, rmp                ; off buzzer
    rcall second
    dec buzzcounter   
    cpi buzzcounter, 0   
    brne buzzloop                ; Beep according to the threshold
    ldi mesure, 0                ; Reset Ring in bit
   
    rjmp Measureroutine


;**********************************************************************************
secondtimer025 :


    ldi rmp, 2
    mov loop3r, rmp
    ldi rmp, 77
    mov loop2r,rmp
    mov    loop1r,rmp

loop3 :
    dec loop3r
    BRNE loop2                ; 0,25 second timer
    ret

loop2 :
    dec loop2r
    breq loop3
loop1 :
    dec loop1r
    breq loop2
    rjmp loop1
  
; Buzzer *************************************************************************************

buzzer :

    ldi rmp, 0
    out TCCR0A, rmp
    out TCCR0B, rmp
    out OCR0A, rmp

    ldi rmp, (1<    out TCCR0A, rmp                                    ; Toggle OC0A on compare match, CTC mode
    ldi rmp, 60                                    ;
    out OCR0A, rmp                                    ; OC0A on in a 4khz frequency
    ldi rmp, (1<    out TCCR0B, rmp                                    ; , Timer on & 8 prescaling
   
    ret

; 1 second timer 1 set
   
    second :
    sei
    ldi rmp,60
    out OCR1C, rmp
    ldi rmp, 0
    out TCNT1, rmp
    ldi rmp, (1<    out TIMSK, rmp        ; enable overflow interrupt to prompt the end
    ldi rmp, (1<    out TCCR1, rmp                ; clock/16384
    ldi rmp,(1<    out GTCCR, rmp            ; reset prescaler to start timer immediately

   
    CLR FLAGS
    endwait :
    sbrs flags, 0            ; Check overflow bit, skip if set
    rjmp endwait            ; Wait for timer overflow
   
    ret
    ; End