Gisteren heb ik de code eindelijk werkend gekregen en vandaag heb ik de temperatuursensor gemonteerd op de koude kant van de peltier.
De regelprint in werking:
De temperatuursensor gemonteerd:
Hier is goed te zien hoe de peltier tussen de koelplaat en het aluminium plaatje is geklemd:
De koelblok is van een oude P2 processor.
Het nieuwe schema:
Componenten lijst:
Naam: |
Waarde: |
R1, R2, R3, R4, R5, R6, R7 |
180 Ohm |
R9, R11, R12 |
1 KOhm |
R13, R14 |
4k7 |
C1, C2, C3, C4 |
100nF |
7Seg1, 7Seg2 |
7-Segment display CC |
T1 |
High power darlington |
T3, T4 |
BC547 |
VR1 |
7805 |
IC1 |
PIC16F628 |
IC2 |
TC74A0 |
De code:
'****************************************************************
'* Author : Coenen Stijn [Stynus] *
'* Notice : Copyright (c) 2008 ElektronicaStynus.be *
'* : All Rights Reserved *
'* Date : 15/06/2008 *
'* Version : 1.2 *
'* Notes : *
'* : *
'****************************************************************
Device 16F628A
Config WDT_OFF, PWRTE_ON, MCLRE_OFF, INTRC_OSC_NOCLKOUT, LVP_off
ALL_DIGITAL = true
'****************************************************************
Symbol digit1 = PORTB.5
Symbol digit2 = PORTA.1
Symbol digitA = PORTA.0
Symbol digitB = PORTA.7
Symbol digitC = PORTA.2
Symbol digitD = PORTB.6
Symbol digitE = PORTB.3
Symbol digitF = PORTA.6
Symbol digitG = PORTB.2
Symbol peltier = PORTB.4
Symbol SCL = PORTB.0
Symbol SDA = PORTB.1
Dim getal1 As Byte
Dim getal2 As Byte
Dim getal As Byte
Dim index As Byte
Dim temperatuur As Byte
Symbol gewenst = 10
'****************************************************************
init:
Clear
I2Cin SDA,SCL,$90,[$00]
'****************************************************************
main:
While 1 = 1
GoSub sensorIn
getal1 = temperatuur / 10
getal2 = (temperatuur - (getal1 * 10))
GoSub dispUit
If temperatuur < gewenst Then
Low peltier
Else
High peltier
EndIf
Wend
'****************************************************************
sensorIn:
I2Cin SDA, SCL,$91,[temperatuur]
Return
'****************************************************************
dispUit:
' A
' F B
' G
' E C
' D
For index = 0 To 1
If index = 0 Then
getal = getal1
High digit1
EndIf
If index = 1 Then
High digit2
getal = getal2
EndIf
Select getal
Case 0
High digitA
High digitB
High digitC
High digitD
High digitE
High digitF
Low digitG
Case 1
Low digitA
High digitB
High digitC
Low digitD
Low digitE
Low digitF
Low digitG
Case 2
High digitA
High digitB
Low digitC
High digitD
High digitE
Low digitF
High digitG
Case 3
High digitA
High digitB
High digitC
High digitD
Low digitE
Low digitF
High digitG
Case 4
Low digitA
High digitB
High digitC
Low digitD
Low digitE
High digitF
High digitG
Case 5
High digitA
Low digitB
High digitC
High digitD
Low digitE
High digitF
High digitG
Case 6
High digitA
Low digitB
High digitC
High digitD
High digitE
High digitF
High digitG
Case 7
High digitA
High digitB
High digitC
Low digitD
Low digitE
Low digitF
Low digitG
Case 8
High digitA
High digitB
High digitC
High digitD
High digitE
High digitF
High digitG
Case 9
High digitA
High digitB
High digitC
High digitD
Low digitE
High digitF
High digitG
EndSelect
DelayMS 2
Low digitA
Low digitB
Low digitC
Low digitD
Low digitE
Low digitF
Low digitG
Low digit1
Low digit2
Next
Return
'****************************************************************
End