Universal IOT Remote

Universal IOT Remote

thingiverse

I enjoy playing around with home automation projects and until now have only had a web interface for most things. While this is convenient and allows me to access my various sensors and actuators using a smartphone or PC, nothing beats the speed and accessibility of a remote control -- Always on, always ready. That is the goal of this project. Something quick to pick-up that allows me to trigger/execute common tasks at the push of a button without needing to wake a pc, to unlock a phone, or even a screen. The remote uses very little power when not in use, less than 1uA. A CR2032 can power the device for years. Three of the buttons will not wake the uC from sleep but can be used as modifier keys similar to CTRL, ALT, and Shift. These keys combined with the fact that you can detect multiple keys pressed at once, holding keys for a period of time, etc. allows for an excessive number of possible actions you can trigger with the remote. You can use the remote to turn on a TV, close the garage, wake a PC, send a panic text or email to relatives, turn on lights, or even as an Amazon Dash button. This project is very much a work in progress with a long list of planned improvements and bugs to fix. If you have any suggestions on how to improve the idea, please leave a comment. P.S. I know the physical design is lacking but I don't have the proficiency needed with CAD software to make something more aesthetically appealing and ergonomic. Update 11/27/2016: Uploaded a new case design. It has not been tested yet. Print Settings Printer: Monoprice Maker Select Rafts: No Supports: No Resolution: 0.1 Infill: 17% C Code Raspberry PI #include "bcm2835.h" #include "NRFComm.h" #include "NRFConfig.h" #include "NRFFunctions.h" #include "bcm2835Config.h" #define NRF_REM_PIPE 1 int main(int argc, char **argv){ unsigned char NRFStatus = 0; unsigned char payloadLen = 0; unsigned char lastCommand = 0; bcmInit(); NRFReset(); NRFInit(); NRFRXMode(); NRFOn(); while(1){ NRFStatus = NRF_readRegister(NRF_REGISTER_STATUS); if(NRFStatus & NRF_BIT_RX_DR || (NRF_readRegister(NRF_REGISTER_FIFO_STATUS) & 1) == 0){// Check Status And FIFO Registers For Waiting Payload NRF_setBit(NRF_REGISTER_STATUS, NRF_BIT_RX_DR);// Clear RX Bit In Status Register payloadLen = NRF_readCommand(NRF_COMMAND_R_RX_PL_WID); if(payloadLen > 1) & 7) == NRF_REM_PIPE){// Check Which Pipe Has Data if(lastCommand != NRFpayload[0]){// Temporary Fix To Prevent Commands Being Run More Than Once Per Keypress lastCommand = NRFpayload[0]; switch(lastCommand){ case 1: system("wakeonlan xx:xx:xx:xx:xx:xx");// Wake PC break; case 2: system("ssh root@192.168.1.1 sudo shutdown -P 0");// Shutdown PC break; case 3: system("sudo reboot");// Reboot Raspberry Pi break; case 4: system("minidlnad -R");// Rebuild MiniDLNA Database break; case 5: system("lights.sh --on");// Turn Lights On break; case 6: system("lights.sh --off");// Turn Lights Off break; case 7: system("lights.sh --brightness=50");// Adjust Light Intensity break; case 8: system("garage.sh --close");// Close Garage Door system("mysql -uroot -proot HomeAudit -e 'INSERT INTO AutomationLog (timestamp) values (UNIX_TIMESTAMP(now()));'"); break; case 9: system("sos.sh --panic");// SOS -- Get Help break; case 10: system("implode.sh");// Destroy Files break; /* ........................... */ default: case 0: ;// Part Of The Temporary Fix To Prevent Duplicate Keypress Events. On Keyup "0" Is Sent From Remote } } } }else{ NRF_writeCommand(NRF_COMMAND_FLUSH_RX); } } } } PIC16F628A #pragma config FOSC = INTOSCIO // Internal oscillator - I/O on RA6 and RA7 #pragma config WDTE = OFF // Watchdog timer off #pragma config PWRTE = ON // Power-up timer enabled #pragma config MCLRE = OFF // Disable master clear #pragma config BOREN = OFF // Disable brown-out detection #pragma config LVP = OFF // Disable low voltage program - free RB4 #pragma config CPD = OFF // No EEPROM protection #pragma config CP = OFF // No code protection #include #include "NRFComm.h" #include "NRFConfig.h" #include "NRFFunctions.h" #define _XTAL_FREQ 4000000 #define NRF_MOSI RA0 #define NRF_CSN RA1 #define NRF_CE RA2 #define NRF_SCK RA6 #define NRF_MISO RA7 unsigned char newKeypress = 0; static volatile unsigned char waste = 0; void nrf(void){ unsigned char NRFStatus = 0; while(newKeypress){ NRFStatus = NRF_readRegister(NRF_REGISTER_STATUS); if(NRFStatus & NRF_BIT_TX_DS){ NRF_setBit(NRF_REGISTER_STATUS, NRF_BIT_TX_DS); newKeypress = 0; NRFOff(); } if(NRFStatus & NRF_BIT_MAX_RT){ NRF_setBit(NRF_REGISTER_STATUS, NRF_BIT_MAX_RT); NRF_writeCommand(NRF_COMMAND_FLUSH_TX); newKeypress = 0; NRFOff(); } } } void interrupt isr(void){ if(RBIF){ waste = PORTB; // Must read or write portb to clear IOC condition RBIF = 0; } } // @TODO Many Bug Fixes. Add Modifier Keys RA3-RA5 void main(void) { unsigned char i = 0; unsigned char keysPressed = 0; OPTION_REG = 0b01001000; INTCON = 0b10001000; CMCON = 0b00000111;//Disable comparator TRISA = 0b10111000; TRISB = 0b11110000; PORTA = 0b00000000; PORTB = 0b00000000; NRFInit(); NRFTXMode(); NRFOff(); asm("sleep"); asm("nop"); while(1){ if(!newKeypress){ TRISB = 240 | ~(1 > 4) != 15){ NRFOn(); NRFpayload[0] = (PORTB & 240) | (TRISB & 15); NRF_writePayload(NRF_COMMAND_W_TX_PAYLOAD, 1); NRFTransmit(); newKeypress = 1; keysPressed++; nrf(); } if(++i == 4){ i=0; if(keysPressed == 0){ NRFOn(); newKeypress = 1; NRFpayload[0] = 0; NRF_writePayload(NRF_COMMAND_W_TX_PAYLOAD, 1);// Temporary Fix. Allows RX To Detect Keydown And Keyup, Messy Debounce Function Essentially. NRFTransmit(); nrf(); NRFOff(); TRISB = 0b11110000; asm("sleep"); asm("nop"); } keysPressed = 0; } } } }

Download Model from thingiverse

With this file you will be able to print Universal IOT Remote with your 3D printer. Click on the button and save the file on your computer to work, edit or customize your design. You can also find more 3D designs for printers on Universal IOT Remote.