Skip to content

abaretta/nu.baretta.itho

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

nu.baretta.itho

Control ITHO mechanical ventilation unit with Homey

Initial version aiming to reconcile the Arduino CC1101 signal definition with Homey's signal definition. Note that the Itho protocol contains two different messages, message1 for older units, and message2 for new units (as well as joining/leaving). There are some differences between the signals of the two message types, initially the focus is on message1 (as it turns out it's all that is needed to turn my Itho unit to 'High' ;-).

Arduino CC1101: Configuration reverse engineered from remote print. The commands below are used by IthoDaalderop.

Base frequency		868.299866MHz
Channel				0
Channel spacing		199.951172kHz
Carrier frequency	868.299866MHz
Xtal frequency		26.000000MHz
Data rate			8.00896kBaud
Manchester			disabled
Modulation			2-FSK
Deviation			25.390625kHz
TX power			?
PA ramping			enabled
Whitening			disabled

writeCommand(CC1101_SRES);
delayMicroseconds(1);
writeRegister(CC1101_IOCFG0 ,0x2E);		//High impedance (3-state)
writeRegister(CC1101_FREQ2 ,0x21);		//00100001	878MHz-927.8MHz
writeRegister(CC1101_FREQ1 ,0x65);		//01100101
writeRegister(CC1101_FREQ0 ,0x6A);		//01101010
writeRegister(CC1101_MDMCFG4 ,0x07);	//00000111
writeRegister(CC1101_MDMCFG3 ,0x43);	//01000011
writeRegister(CC1101_MDMCFG2 ,0x00);	//00000000	2-FSK, no manchester encoding/decoding, no preamble/sync
writeRegister(CC1101_MDMCFG1 ,0x22);	//00100010
writeRegister(CC1101_MDMCFG0 ,0xF8);	//11111000
writeRegister(CC1101_CHANNR ,0x00);		//00000000
writeRegister(CC1101_DEVIATN ,0x40);	//01000000
writeRegister(CC1101_FREND0 ,0x17);		//00010111	use index 7 in PA table
writeRegister(CC1101_MCSM0 ,0x18);		//00011000	PO timeout Approx. 146�s - 171�s, Auto calibrate When going from IDLE to RX or TX (or FSTXON)
writeRegister(CC1101_FSCAL3 ,0xA9);		//10101001
writeRegister(CC1101_FSCAL2 ,0x2A);		//00101010
writeRegister(CC1101_FSCAL1 ,0x00);		//00000000
writeRegister(CC1101_FSCAL0 ,0x11);		//00010001
writeRegister(CC1101_FSTEST ,0x59);		//01011001	For test only. Do not write to this register.
writeRegister(CC1101_TEST2 ,0x81);		//10000001	For test only. Do not write to this register.
writeRegister(CC1101_TEST1 ,0x35);		//00110101	For test only. Do not write to this register.
writeRegister(CC1101_TEST0 ,0x0B);		//00001011	For test only. Do not write to this register.
writeRegister(CC1101_PKTCTRL0 ,0x12);	//00010010	Enable infinite length packets, CRC disabled, Turn data whitening off, Serial Synchronous mode
writeRegister(CC1101_ADDR ,0x00);		//00000000
writeRegister(CC1101_PKTLEN ,0xFF);		//11111111	//Not used, no hardware packet handling

//0x6F,0x26,0x2E,0x8C,0x87,0xCD,0xC7,0xC0
writeBurstRegister(CC1101_PATABLE | CC1101_WRITE_BURST, (uint8_t*)ithoPaTableSend, 8);

writeCommand(CC1101_SIDLE);
writeCommand(CC1101_SIDLE);
writeCommand(CC1101_SIDLE);

writeRegister(CC1101_MDMCFG4 ,0x08);	//00001000
writeRegister(CC1101_MDMCFG3 ,0x43);	//01000011
writeRegister(CC1101_DEVIATN ,0x40);	//01000000
writeRegister(CC1101_IOCFG0 ,0x2D);		//GDO0_Z_EN_N. When this output is 0, GDO0 is configured as input (for serial TX data).
writeRegister(CC1101_IOCFG1 ,0x0B);		//Serial Clock. Synchronous to the data in synchronous serial mode.

writeCommand(CC1101_STX);
writeCommand(CC1101_SIDLE);
delayMicroseconds(1);
writeCommand(CC1101_SIDLE);

writeRegister(CC1101_MDMCFG4 ,0x08);	//00001000
writeRegister(CC1101_MDMCFG3 ,0x43);	//01000011
writeRegister(CC1101_DEVIATN ,0x40);	//01000000
//writeRegister(CC1101_IOCFG0 ,0x2D);		//GDO0_Z_EN_N. When this output is 0, GDO0 is configured as input (for serial TX data).
//writeRegister(CC1101_IOCFG1 ,0x0B);		//Serial Clock. Synchronous to the data in synchronous serial mode.

//Itho is using serial mode for transmit. We want to use the TX FIFO with fixed packet length for simplicity.
writeRegister(CC1101_IOCFG0 ,0x2E);
writeRegister(CC1101_IOCFG1 ,0x2E);	
writeRegister(CC1101_PKTLEN , 19);
writeRegister(CC1101_PKTCTRL0 ,0x00);
writeRegister(CC1101_PKTCTRL1 ,0x00);	 

Homey signal definition:

      "signals": {
            "868": {
                    "MESSAGE1": {
                            "sof": [],
                            "eof": [],
                            "words": [
                                    [ 255,254 ],
                                    [ 255,255 ]
                            ],
                            "interval": 1000,
                            "sensitivity": 0.5,
                            "repetitions": 3,
                            "cmds": {
                                    "LOW":   [ 1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,1,0,1,0,0,1,1,0,0,1,1,0,1,0,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,0,1,0,1,1,0,1,0,1,0,1,0,0,1,1,0,0,1,1,0,1,0,1,0,1,0,1,0,0,1,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,0,1,1,0,1,0,1,0,0,1,1,0,1,0,1,0,1,0,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,1,0,1,0,1,0,1,0,1 ],
                                    "HIGH1": [ 1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,1,0,1,0,0,1,1,0,0,1,1,0,1,0,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,0,1,0,1,1,0,1,0,1,0,1,0,0,1,1,0,0,1,1,0,1,0,1,0,1,0,1,0,0,1,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,0,1,1,0,0,1,0,1,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,1,0,1,0,1,0,1,0,1 ],
                                    "MEDIUM": [ 1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,1,0,1,0,0,1,1,0,0,1,1,0,1,0,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,0,1,0,1,1,0,1,0,1,0,1,0,0,1,1,0,0,1,1,0,1,0,1,0,1,0,1,0,0,1,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,0,1,0,1,0,1,1,0,1,0,1,0,1,0,0,1,1,0,1,0,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,1,0,1,0,1,0,1,0,1 ],
                                    "TIMER1": [ 1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,1,0,1,0,0,1,1,0,0,1,1,0,1,0,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,0,1,0,1,1,0,1,0,1,0,1,0,0,1,1,0,0,1,1,0,1,0,1,0,1,0,0,1,1,0,1,0,1,0,0,1,1,0,1,0,1,0,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,0,1,0,1,0,1,1,0,1,0,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,1,0,1,0,1,0,1,0,1 ],
                                    "TIMER2": [ 1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,1,0,1,0,0,1,1,0,0,1,1,0,1,0,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,0,1,0,1,1,0,1,0,1,0,1,0,0,1,1,0,0,1,1,0,1,0,1,0,1,0,0,1,1,0,1,0,1,0,0,1,1,0,1,0,1,0,0,1,1,0,0,1,1,0,1,0,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,1,0,1,0,1,0,1,0,1 ],
                                    "TIMER3": [ 1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,1,0,1,0,0,1,1,0,0,1,1,0,1,0,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,0,1,0,1,1,0,1,0,1,0,1,0,0,1,1,0,0,1,1,0,1,0,1,0,1,0,0,1,1,0,1,0,1,0,0,1,1,0,1,0,1,0,0,1,0,1,0,1,0,1,1,0,1,0,1,0,1,0,0,1,0,1,0,1,1,0,1,0,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,1,0,1,0,1,0,1,0,1 ]
                                    },
                            "txOnly": true,
                            "modulation": {
                                    "type": "FSK",
                                    "baudRate": 8009,
                                    "channelSpacing": 199951,
                                    "channelDeviation": 25391
                            },
                            "carrier": 868299866
                    }
            }
    }
command LOW:
message1: 170,170,170,173,51,83,51,43,84,205,84,213,85,83,83,84,170,171,85
commandstring:
1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,1,0,1,0,0,1,1,0,0,1,1,0,1,0,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,0,1,0,1,1,0,1,0,1,0,1,0,0,1,1,0,0,1,1,0,1,0,1,0,1,0,1,0,0,1,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,0,1,1,0,1,0,1,0,0,1,1,0,1,0,1,0,1,0,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,1,0,1,0,1,0,1,0,1

command MEDIUM:
message1: 170,170,170,173,51,83,51,43,84,205,84,213,85,74,213,52,170,171,85
commandstring: 1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,1,0,1,0,0,1,1,0,0,1,1,0,1,0,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,0,1,0,1,1,0,1,0,1,0,1,0,0,1,1,0,0,1,1,0,1,0,1,0,1,0,1,0,0,1,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,0,1,0,1,0,1,1,0,1,0,1,0,1,0,0,1,1,0,1,0,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,1,0,1,0,1,0,1,0,1

command HIGH:
message1: 170,170,170,173,51,83,51,43,84,205,84,213,85,50,203,52,170,171,85
commandstring: 1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,1,0,1,0,0,1,1,0,0,1,1,0,1,0,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,0,1,0,1,1,0,1,0,1,0,1,0,0,1,1,0,0,1,1,0,1,0,1,0,1,0,1,0,0,1,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,0,1,1,0,0,1,0,1,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,1,0,1,0,1,0,1,0,1

command TIMER1:
message1: 170,170,170,173,51,83,51,43,84,205,83,83,84,204,202,180,170,171,85
commandstring: 1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,1,0,1,0,0,1,1,0,0,1,1,0,1,0,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,0,1,0,1,1,0,1,0,1,0,1,0,0,1,1,0,0,1,1,0,1,0,1,0,1,0,0,1,1,0,1,0,1,0,0,1,1,0,1,0,1,0,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,0,1,0,1,0,1,1,0,1,0,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,1,0,1,0,1,0,1,0,1

command TIMER2:
message1: 170,170,170,173,51,83,51,43,84,205,83,83,83,53,52,180,170,171,85
commandstring: 1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,1,0,1,0,0,1,1,0,0,1,1,0,1,0,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,0,1,0,1,1,0,1,0,1,0,1,0,0,1,1,0,0,1,1,0,1,0,1,0,1,0,0,1,1,0,1,0,1,0,0,1,1,0,1,0,1,0,0,1,1,0,0,1,1,0,1,0,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,1,0,1,0,1,0,1,0,1

command TIMER3:
message1: 170,170,170,173,51,83,51,43,84,205,83,83,82,173,82,180,170,171,85
commandstring: 1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,1,0,1,0,0,1,1,0,0,1,1,0,1,0,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,0,1,0,1,1,0,1,0,1,0,1,0,0,1,1,0,0,1,1,0,1,0,1,0,1,0,0,1,1,0,1,0,1,0,0,1,1,0,1,0,1,0,0,1,0,1,0,1,0,1,1,0,1,0,1,0,1,0,0,1,0,1,0,1,1,0,1,0,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,1,0,1,0,1,0,1,0,1

About

Control ITHO mechanical ventilation unit with Homey

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published