Components and supplies
Arduino Nano R3
Microchip ATtiny 1614 Processor
Project description
Code
RF-sniffer code
arduino
1/* 2 * ard-rf-sniffer (instrument monitor or threshold alarm) 3 * by Marco Zonca 05/2022 4 * 5 * LT5534 50-3000Mhz rf detector IC, ATTiny1614 3.3V MCU, LIR2450 rechargeable battery, MCP73831 4.2V charger IC, active buzzer, 6 * 2x 2 pos. dipswitch, trimmer, RGB led, red led, SMA-F antenna, SMA-M panel connector, on/off switch, some SMD resistors and capacitors 7 * 8 * Remember to connect a specific antenna for every rf frequency range you want to detect; 9 * in some cases a simple ring wire of any lenght can be enough as "antenna", expecially when the rf signal is strong 10 * 11 * LT5534 datasheet says to not overcharge the rf input pin with signals > 10dbm (i.e. handheld 5W radio tx near the IC); 12 * if it is the case, I suggest to put an attenuator between the antenna and the circuit (i.e. 20dbm SMA-MF serial attenuator). 13 * Additionally use full metal box or, as I did, cover the interiors of the plastic box with copper foil to avoid signals passing trought, 14 * or paint/spray with conductive material the interiors of the box (i.e. graphite). 15 * 16 */ 17 18byte pin_ledred = 0; 19byte pin_ledgreen = 6; 20byte pin_ledblue = 7; 21byte pin_DS1_instrcomparat = 1; 22byte pin_DS1_buzz = 2; 23byte pin_DS2_bit1color = 3; 24byte pin_DS2_bit0color = 4; 25byte pin_threshold = 8; 26byte pin_vrf = 9; 27byte pin_buzzer = 10; 28 29byte a=0; 30byte b=0; 31 32bool isBuzzer=false; 33bool isInstrument=false; 34byte ledColor=0; 35byte pin_LED=0; 36byte buzlevel=250; // buzzer loudness: 125/255 (125=50%, max 255=100%) 37byte Off=0; 38byte On=75; // led brightness: 75/255 (75=30%, max 125=50%) 39 40int rfSignal=0; 41int rfThreshold=0; 42int setBUZ=0; 43int setLED=0; 44 45long LedblinkMillis=10000; 46unsigned long prevLedblinkMillis=0; 47long ReadSetupMillis=2000; 48unsigned long prevReadSetupMillis=0; 49 50void setup() { 51 pinMode(pin_ledred, OUTPUT); 52 pinMode(pin_ledgreen, OUTPUT); 53 pinMode(pin_ledblue, OUTPUT); 54 pinMode(pin_buzzer, OUTPUT); 55 pinMode(pin_DS1_instrcomparat, INPUT_PULLUP); 56 pinMode(pin_DS1_buzz, INPUT_PULLUP); 57 pinMode(pin_DS2_bit1color, INPUT_PULLUP); 58 pinMode(pin_DS2_bit0color, INPUT_PULLUP); 59 pinMode(pin_threshold, INPUT); 60 pinMode(pin_vrf, INPUT); 61 readSetup(); 62 initialShow(); 63 prevLedblinkMillis=millis(); 64}//setup() 65 66void loop() { // ------------------------------------------------------------> 67 rfSignal=analogRead(pin_vrf); 68 rfThreshold=analogRead(pin_threshold); 69 if (isInstrument) { // -------- instrument monitor 70 setBUZ=map(rfSignal,rfThreshold,1023,0,buzlevel); 71 if (isBuzzer) analogWrite(pin_buzzer,setBUZ); 72 setLED=map(rfSignal,rfThreshold,1023,0,On); 73 if (pin_LED != -1) analogWrite(pin_LED,setLED); 74 delay(100); 75 if (isBuzzer) analogWrite(pin_buzzer, Off); 76 if (pin_LED != -1) analogWrite(pin_LED,Off); 77 } else { // ----------------- threshold alarm 78 if (rfSignal > rfThreshold) tAlarm(); 79 } 80 if ((isInstrument==false) && (prevLedblinkMillis + LedblinkMillis) < millis()) blinkLed(); 81 if ((prevReadSetupMillis + ReadSetupMillis) < millis()) readSetup(); 82}//loop() --------------------------------------------------------------------< 83 84void tAlarm() { 85 for (a=1;a<=3;a++) { 86 if (pin_LED != -1) analogWrite(pin_LED,On); 87 if (isBuzzer) analogWrite(pin_buzzer, buzlevel); 88 delay(200); 89 if (pin_LED != -1) analogWrite(pin_LED,Off); 90 if (isBuzzer) analogWrite(pin_buzzer, Off); 91 delay(200); 92 } 93}//tAlarm() 94 95void blinkLed() { 96 if (pin_LED != -1) { 97 analogWrite(pin_ledgreen,On); 98 delay(200); 99 analogWrite(pin_ledgreen,Off); 100 delay(200); 101 } 102 prevLedblinkMillis=millis(); 103}//blinkLed() 104 105void initialShow() { 106 if (isBuzzer) analogWrite(pin_buzzer, buzlevel); 107 analogWrite(pin_ledred,On); 108 delay(200); 109 if (isBuzzer) analogWrite(pin_buzzer, Off); 110 analogWrite(pin_ledred,Off); 111 analogWrite(pin_ledgreen,On); 112 delay(200); 113 analogWrite(pin_ledgreen,Off); 114 analogWrite(pin_ledblue,On); 115 delay(200); 116 analogWrite(pin_ledblue,Off); 117 delay(200); 118}//initialShow() 119 120void readSetup() { 121 isBuzzer=!digitalRead(pin_DS1_buzz); 122 isInstrument=!digitalRead(pin_DS1_instrcomparat); 123 a=!digitalRead(pin_DS2_bit0color); 124 b=!digitalRead(pin_DS2_bit1color) * 10; 125 ledColor=a+b; 126 switch (ledColor) { 127 case 0: 128 pin_LED=-1; // no led 129 break; 130 case 1: 131 pin_LED=pin_ledred; 132 break; 133 case 10: 134 pin_LED=pin_ledgreen; 135 break; 136 case 11: 137 pin_LED=pin_ledblue; 138 break; 139 } 140 prevReadSetupMillis=millis(); 141}//readSetup() 142
Downloadable files
PCB rf-sniffer top
PCB rf-sniffer top
PCB rf-sniffer bottom
PCB rf-sniffer bottom
PCB rf-sniffer topsilk
PCB rf-sniffer topsilk
Comments
Only logged in users can leave comments
marcozonca
0 Followers
•0 Projects
Table of contents
Intro
3
0