Schnapso

Aus Echtcool Wiki
Wechseln zu: Navigation, Suche

Schnapsomat.png

Inhaltsverzeichnis

Schnapsomat

Elektronischer Barmixer 16 Getränke. Steuerung über 10" Android Tablet und Bluetoothverbindung.

Schnap.png

Hardware

Mischventil 16 Magnetventile inkl. BUS-Elektronik

16CHANNEL HEAD.jpg


Belegung SF(SaufPort)

SUB-D-15-polig.png


PIN Funktion -
PIN1 OUT1 --
PIN2 OUT3 --
PIN3 +12V --
PIN4 CS2 Chipselect --
PIN5 SCK --
PIN6 SO --
PIN7 RESET --
PIN8 GND --
PIN9 OUT2 --
PIN10 OUT4 --
PIN11 +12V --
PIN12 CS1 --
PIN13 SI --
PIN14 +3,3V --
PIN15 GND --


Raspberry PI 3 mit Windows 10 IoT(Internet of Things)

RP2 Pinout.png

Versuchsaufbau (DEPRECATED)

20140721 200811.jpg

Controller(DEPRECATED)

MCU: ATXmega 128 a3


Board.png

Belegung:

PIN Funktion PIN Funktion -
PE7 SPIE SCK - V17 +Vin +5V Stromversorgung --
PE6 SPIE MISO - V18 Masse -5V Masse --
PE5 SPIE MOSI - V19 PF2 TXD0 RS232 USB --
PE4 SPIE SS - V20 PF3 RXD0 RS232 USB --
PE3 V21 PF1 XCK0 RS232 USB --
PE2 V22 RES2 USB RESET --
PE1 SCL I2C PF2 +3,3V --
PE0 SDA I2C PF0 - --
PD7 V23 /RES /RES --
PD6 V24 PDIC PDIC --
PD5 V25 Wasser PF4 V01 --
PD4 V26 Kompressor PF5 V02 --
PD3 TXD0 RS232 Display PF6 V03 --
PD2 RXD0 RS232 Display PF7 V04 --
PD1 XCK0 RS232 Display PA0 V05 --
PD0 Touch INT PA1 V06 --
PC7 TXD1 RS232 BLUETOOTH PA2 V07 --
PC6 RXD1 RS232 BLUETOOTH PA3 V08 --
PC5 XCK1 RS232 BLUETOOTH PA4 V09 --
PC4 - PA5 V10 --
PC3 TXD0 RS232 WAAGE PA6 V11 --
PC2 RXD0 RS232 WAAGE PA7 V12 --
PC1 XCK0 RS232 WAAGE PB0 V13 --
PC0 LED4 PB1 V14 --
PB7 LED3 PB2 V15 --
PB6 LED2 PB3 V16 --
PB5 LED1 PB4 SUMMER --
Batt+3V +3,3V +L +Audio --
GND GND -L -Audio --


MCP23S17

16-bit I/O Expander mit Highspeed SPI-Interface, DIP-28

Datenblatt: [[1]]

ULN2803A

8-Kanal Darlington-Treiber, DIP18

[[2]]Datenblatt

Mischventil 17 Magnetventile(DEPRECATED)

Ventilkopf-Model.png Ventilkopf-Model1.png

20140813 181238.jpg


Industriewaage mit RS232 Schnittstelle

Waage.png

9600 Baud 1 Stoppbit 8 Datenbit no parity

Mit dem Befehl <A> (ohne CRLF) wird das aktuelle Gewicht zurückgegeben

Luftverteilung

Die Druckluft wird durch einen Inhalator-Kompressor erzeugt welcher über 6x4mm Schläuche über die Ventilgruppen mit den Flaschen verbunden ist.

Test.JPG


Luft18.jpg

BASCOM

BASCOM-AVR DemoVersion

Bascom Befehle

Handbuch PDF


Programm

Bluetooth Protokoll

W (altuelles Gewicht)

D|DrID|Name|Taste|Alc|Res|CRC

R|DrID|SourceID1|Volume1|SourceID2|Volume2|..........|SourceIDx|Volumex|CRC


Q|VentID|SourceID|CRC

S|DrID|CRC (Start Mix)

L (List Drinks)

C|VentID|0/1|CRC (Clean)

T|Date|Time|crc (Time and Date)

Beispiel:
D|001|Spezi klassisch|suess|0.0|crc
R|001|01|120|02|150|crc
Q|01|01|crc
Q|02|02|crc
S|001|crc

Controllerbefehle

GetWeight

SetVentil (n)

ResetVentil (n)

VentilTimeOut (t)


Sound Engine

http://www.zedge.net/ringtone/1702582/

Testprogramm

 
$regfile = "xm128a3def.dat"
'                             'für ATxMega128a3-Controller
$crystal = 32000000                                         '32MHz
$hwstack = 128
$swstack = 128
$framesize = 128
Dim Altdat As String * 8
Dim Test As String * 82
'#############################################################################################
'#                                                                                           #
'#                 Schnapsi 1.0                                                              #
'#                                                                                           #
'#############################################################################################
'Enable Interrupts
'Einstellungen für ATXMega
$lib "xmega.lib" : $external _xmegafix_clear : $external _xmegafix_rol_r1014
Config Osc = Disabled , 32mhzosc = Enabled                  'internen 32MHz-Oszillator  aktivieren
Config Sysclock = 32mhz , Prescalea = 1 , Prescalebc = 1_1
Config Priority = Static , Vector = Application , Lo = Enabled , Hi = Enabled       'Enable Lo Level Interrupts
Config Date = Dmy , Separator = .                           ' ANSI-Format
Config Sysclock = 32mhz , Prescalea = 1 , Prescalebc = 1_1
Config Clock = Soft , Rtc = 1khz_int32khz_ulp               ' we select the internal 1 KHz clock from the 32KHz internal oscillator
Date$ = "18.07.14"
Time$ = "10:29:00"
Dim Dc_network As String * 10
Dim Dc_apn As String * 20
Dim Dc_hostname As String * 30
Dim Car_km As String * 7
Dim Car_km1 As String * 7
Dim L As Long                                   'Am Anfang Variable definieren
L = 51                                                      '115200 = 16 38400 = 51    = (MHZ / BAUD / 16) -1
Dim Uh As Byte At L + 1 Overlay
Dim Buffer_full As Bit
Dim I As Byte
Dim Keyup As Bit                                            'Tastenentprellung
Const Max_buf_len = 64                                      'max rs232 buffer length
'variabel
Dim Initcounter As Byte                                     'Needet for initializing BT
Dim State_cnt As Bit                                        'state counter for uart isr step
Dim Chrx As String * 1                                      '1string
Dim Buff As String * Max_buf_len                            'buffer rs232
Dim Buff_ok As String * Max_buf_len                         'valid data from rs232
Dim Flag_data_ready As Bit
Dim Gpgga(16) As String * 12
Dim Gpvtg(9) As String * 12
Dim Bcout As Byte
Dim Tmpb As Byte
Dim Flash As Byte
Dim Tmpstr As String * 80
Dim Tmpstr2 As String * 10


Dim Bc As Byte
dim DataRec as  Byte

Dim B As Bit
dim BC1 as string * 10
dim send_str as string * 10

'CommandListe
dim cmd as string * 10
dim cmdlst(3) as string * 100



Config Porte.7 = Output                                     'GSM EIN/AUS
Config Porte.6 = Output                                     'GSM EIN/AUS
Config Porte.5 = Output                                     'GSM EIN/AUS
Config Porte.4 = Output                                     'GSM EIN/AUS

Config PORTA.0 = Output

LED1 alias PORTE.7
LED2 alias PORTE.6
LED3 alias PORTE.5
LED4 alias PORTE.4

Waitms 500

reset B










$include "iLcd_Deklarationen.bas"                           'Deklarationen der LCD-Grafikbefehle
'Declare Function Min2dec(wert As String) As Single          'Dezimalgrad umrechnen


On Usartd0_rxc Rs232_data_int                               'wenn ein Zeichen vom LCD-Modul kommt / XMEGA128a3
Enable Usartd0_rxc , Hi                                     'RXD-Interrupt einschalten           / XMEGA128a3
'On Usartc0_rxc Rs232_data_int1                                'wenn ein Zeichen vom Bluetooth
                                   'RXD-Interrupt einschalten           / XMEGA128a3

Enable Interrupts                                           'Interrupt einschalten

reset DataRec


Config Com3 = 9600 , Mode = Asynchroneous , Parity = None , Stopbits = 1 , Databits = 8       'serielle Schnittstelle Display
Open "COM3:" For Binary As #2                               'serielle Schnittstelle Display
Config Portd.1 = Output                                     'Reset-Pin Display   XMEGA128a3
Lcd_reset Alias Portd.1                                     'als LCD_reset definieren
Portd.1 = 1






                                                'Pullup aktivieren
Config Com1 = 19200 , Mode = Asynchroneous , Parity = None , Stopbits = 1 , Databits = 8       'serielle Schnittstelle Bluetooth
Config Serialin = Buffered , Size = 250 , Bytematch = 13
Enable Usartc0_rxc , Lo
Open "COM1:" For Binary As #1






Call Ilcd_reset                                             'Display zurücksetzen
Wait 2                                                      '2 Sekunden Pause
Call Ilcd_init()                                            '
Call Ilcd_set_background(black)                             'Hintergrundfarbe einstellen                      wd7
Call Ilcd_init_touch()                                      'Touchpanel einschalten

Print #2 , Chr(&H51) ; Chr(&H0a);                           '0D 115200 0A 38400  38400 Baud für Display hochsetzen von 9600
Waitms 100
Usartd0_baudctrla = L
Usartd0_baudctrlb = Uh


Waitms 250

Call Ilcd_init()                                            '
Call Ilcd_set_background(black)                             'Hintergrundfarbe einstellen
Call Ilcd_clear()
Wait 1



Bitwait Lcd_ack , Set
Reset Lcd_ack
Waitms 500

Call Ilcd_rectangle(0 , 50 , 239 , 100 , White , 1)
waitms 20
Call Ilcd_graph_text(30 , 65 , 2 , Red , 1 , 1 , "SCHNAPSOMAT 1.0")
Waitms 10
Call Ilcd_graph_text(30 , 85 , 0 , Black , 1 , 1 , "(c)2014 Jesenko Lukas & Freunde")
waitms 10
Call Ilcd_line(0 , 161 , 239 , 161 , White)

waitms 20

     Buff = ""
'#############################################################################################
'#                                                                                           #
'#                 Main Loop ANFANG                                                          #
'#                                                                                           #
'#############################################################################################


 Call Ilcd_rectangle(0 , 280 , 49 , 319 , White , 1)
 Call Ilcd_rectangle(60 , 280 , 109 , 319 , White , 1)
 Call Ilcd_rectangle(120 , 280 , 169 , 319 , White , 1)
 Call Ilcd_rectangle(180 , 280 , 229 , 319 , White , 1)

 Call Ilcd_opaque(0)
 Call Ilcd_graph_text(20 , 300 , 1 , Blue , 1 , 1 , "X1" ) 'Print the complete Buffer
 Call Ilcd_graph_text(80 , 300 , 1 , Blue , 1 , 1 , "X2" ) 'Print the complete Buffer
 Call Ilcd_graph_text(140 , 300 , 1 , Blue , 1 , 1 , "X3" ) 'Print the complete Buffer
 Call Ilcd_graph_text(200 , 300 , 1 , Blue , 1 , 1 , "X4" ) 'Print the complete Buffer
 Call Ilcd_opaque(0)








do
   If Time$ <> Altdat Then
      Altdat = Time$
      Call Ilcd_opaque(1)                                       'Text nicht durchsichtig !
     ' Call Ilcd_graph_text(190 , 2 , 0 , White , 1 , 1 , Date$)  'Datum
      Call Ilcd_graph_text(190 , 2 , 0 , White , 1 , 1 , Altdat)       'Uhrzeit
      Call Ilcd_opaque(0)
     ' Print #1,"ATC?"
   End If


   if Initcounter = 1 then

      Initcounter=2
   end if


   If DataRec = 1  then
      reset DataRec


      For I = 1 To _rs_bufcountr0
         Buff = Buff + Chr(_rs232inbuf0(i))
      Next

      Call Ilcd_rectangle(0 , 240 , 239 , 260 , Black , 1)
      Call Ilcd_opaque(1)
      Call Ilcd_graph_text(0 , 250 , 0 , Green , 1 , 1 , buff ) 'Print the complete Buffer
      Call Ilcd_opaque(0)

      gosub  AUSWERTEN

      Buff = ""
      Clear Serialin 'Clear Buffer
      Reset LED1
   End If

   waitms 100

   Call Ilcd_get_touch()                                       'Touchpanel abfrage  X_Touch = X-Wert, Y_Touch = Y-Wert                                  '


   If Y_touch > 280 And Y_touch < 319 Then                       'Taste X1
     If X_touch > 0 And X_touch < 59 Then
           Print #1,"#01|GETDRINKMIXLIST"
          ' wait 1
          ' SET LED2                       'KM Buch
     End If

     If X_touch > 60 And X_touch < 119 Then                       'Taste X2
           Print #1,"#01|GETDRINK|01"
          ' wait 1
          ' SET LED3
     End If

    If X_touch > 120 And X_touch < 179 Then                       'Taste X3
           Print #1,"#01|GETUSER"

           'SET LED4
     End If

   If X_touch > 180 And X_touch < 239 Then                       'Taste X4
           Print #1,"#02|GETINFO"
          ' WAIT 1
     End If



   End If




loop


'#############################################################################################
'#                                                                                           #
'#                 Main Loop ENDE                                                            #
'#                                                                                           #
'#############################################################################################



Serial0charmatch:
   set LED1

   Pushall
   Popall

   set DataRec

Return



Auswerten:
   dim retval as  Integer
   dim values(6) as string * 40
   dim alc as string * 25
   dim volstr as string * 15

   'cmdlst = split (buff,"|")
    cmd = Left(buff , 6)



   select case cmd

   case "MIXLST"
         toggle LED2


   Case "DRNKID"   'Mix-Drink Überschrift "DRNKID|001|Drinkname|Geschmack|Alkoholgehalt|Reserve"
        retval = split(buff,values(1),"|")
        toggle LED3
        if values(5) = "0,0" then
           volstr = "% (Alkoholfrei)"
           reset LED4
           else
           volstr = "%"
           set LED4
        end if
        alc = "Alkohol:" + values(5) + volstr
        Call Ilcd_rectangle(0 , 101 , 239 , 160 , Black , 1)
      Call Ilcd_opaque(1)
      Call Ilcd_graph_text(0 , 110 , 3 , Yellow , 1 , 1 , values(3) ) 'Print the complete Buffer
      Call Ilcd_graph_text(0 , 130 , 1 , white , 1 , 1 , values(4) ) 'Print the complete Buffer
      Call Ilcd_graph_text(0 , 145 , 1 , Magenta , 1 , 1 , alc ) 'Print the complete Buffer
      Call Ilcd_graph_text(220 , 145 , 0 , White , 1 , 1 , values(2)) 'Print the complete Buffer

      Call Ilcd_opaque(0)
      print #1, chr(10)
      print #1, "OK"


   Case "MIXSTA"  'Mix-START


   Case "MIXSTO"  'Mix-STOP

   case else
      print #1, "ERROR"



   end select


return







Mischen:








return



'Sub Check_buffer
'      If _rs_head_ptr0 = _rs_tail_ptr0 Then
'         Buff_size = 0
'      Elseif _rs_head_ptr0 > _rs_tail_ptr0 Then
'         Buff_size = _rs_head_ptr0 - _rs_tail_ptr0
'      Else
'         Buff_size = 30 - _rs_tail_ptr0
'         Buff_size = Buff_size + _rs_head_ptr0
'      End If
'End Sub


' Xon Alias &H11                                              'Alias for XON
'Xoff Alias &H13                                             'Alias for XOFF


'Call Check_buffer
'If Buff_size > 20 Then                               'When buffer is 2/3 full , save to eeprom
'         Printbin Xoff



'Printbin Xon
























$include "iLcd_routinen.bas"                                'LCD-Routinen

 
Meine Werkzeuge
Namensräume
Varianten
Aktionen
Navigation
Werkzeuge