NRF24L01P Water Sensor Case

NRF24L01P Water Sensor Case

thingiverse

A custom water sensor based on the PIC12F615 and NRF24L01+ is designed for detection of sump pump failure. Two connectors at the base of the transistor allow separation of the main board from the sensing element if desired. The device can be used to detect when a sump pump fails. The original version of this design included a piezo buzzer, test button, and latching power supply but was later replaced with a minimal version for personal use. A breadboard prototype was tested before deciding on this simplified design. The transistor/FET and base/gate resistor may require experimentation to achieve optimal performance. The initial version consumed up to 5mA of current when the sensing element was submerged in water, causing electrolysis to occur and damaging the copper on the PCB. This issue can be mitigated by disconnecting power to the sensing element or pulsing it to reduce long-term damage. The standby current draw is less than 1uA, while the operating current draw ranges from 9-11.75mA for under 1.5 seconds. After sending an alert or reaching the maximum number of retries, the current draw drops to 2uA, excluding the sensing stage. Printer Settings: Printer: Monoprice Maker Select Rafts: No Supports: No Resolution: 0.2mm Infill: 17% C Code: #include <xc.h> #include "NRFComm.h" #include "NRFConfig.h" #include "NRFFunctions.h" #pragma config FOSC = INTOSCIO #pragma config WDTE = OFF #pragma config PWRTE = ON #pragma config MCLRE = OFF #pragma config CP = OFF #pragma config IOSCFS = 4MHZ #pragma config BOREN = OFF #define _XTAL_FREQ 4000000 #define NRF_CE GP1 #define NRF_CSN GP2 #define NRF_SCK GP4 #define NRF_MOSI GP5 #define NRF_MISO GP3 unsigned char NextRand = 0; unsigned char LastRand = 7; unsigned char rand(void){ NextRand = LastRand * 2917 + 353 | TMR0; LastRand = NextRand; return NextRand; } void main(void) { unsigned char attempts = 0; unsigned char NRFStatus = 0; OPTION_REG = 0b11001000; ANSEL = 0b00000000; WPU = 0b00000000; IOC = 0b00000000; TRISIO = 0b11001000; GPIO = 0b00110100; NRFInit(); NRFTXMode(); NRFOn(); ANSEL = 0b00110000; ADCON0 = 0b10010101; __delay_us(20); GO = 1; while(GO); ADCON0 = 0b00000000; ANSEL = 0b00000000; NRFpayload[0] = 0x00; // Sensor ID NRFpayload[1] = rand(); // Data byte for packet uniqueness NRFpayload[2] = ADRESH; // Battery Status High Byte NRFpayload[3] = ADRESL; // Battery Status Low Byte NRF_writePayload(NRF_COMMAND_W_TX_PAYLOAD, 4); NRFTransmit(); while(1){ NRFStatus = NRF_readRegister(NRF_REGISTER_STATUS); if(NRFStatus & NRF_BIT_TX_DS){ NRF_setBit(NRF_REGISTER_STATUS, NRF_BIT_TX_DS); NRFOff(); GPIO = 0b00110100; // Forcing the SPI output pins high before sleep greatly reduces current draw. asm("sleep"); // Use minimum amount power until the water is dealt with } if(NRFStatus & NRF_BIT_MAX_RT){ NRF_setBit(NRF_REGISTER_STATUS, NRF_BIT_MAX_RT); NRF_writeCommand(NRF_COMMAND_FLUSH_TX); if(++attempts == 20){ // The NRF will already retry a packet up to 15 times but I added this increase the number of attempts just in case. NRFOff(); GPIO = 0b00110100; asm("sleep"); }else{ NRFpayload[1] = rand(); // Change the data byte for the same reason given above. Probably not needed here but why not. NRF_writePayload(NRF_COMMAND_W_TX_PAYLOAD, 1); NRFTransmit(); } } } }

Download Model from thingiverse

With this file you will be able to print NRF24L01P Water Sensor Case 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 NRF24L01P Water Sensor Case.