3445 views|11 replies

6

Posts

0

Resources
The OP
 

Sensor acquisition [Copy link]

 
  I am currently using the cc2530 baseboard of Wireless Dragon to expand the collection of heart rate sensor information and networking. But we encountered a problem. When collecting data from the ADC, the original code used the voltage range to determine which sensor it was. I don't know the range of the heart rate sensor? And therefore, I don't know how to collect heart rate information. We have been stuck here for a long time. Please give us some guidance. Thank you very much!!!
  1. Wireless Dragon original i/o code-------------------------------------------------------- //Initialization I/O for sensor // IO port initialization//--------------------------------------------------------- void InitSensorIO(void) { INT8U Value; IO_DIR_PORT_PIN1(2, 0, IO_OUT);//VCC_33 power switch P2_0 = 1;//Turn on VCC_33 power IO_DIR_PORT_PIN1(0, 4, IO_IN);//Battery voltage test P0INP |= 0x10; ugOled9616int(); IO_DIR_PORT_PIN1(0, 5, IO_IN);//SEL1 IO_DIR_PORT_PIN1(0, 7,IO_IN);//SEL2 Value = ReadSensorAdc(5);//Collect SEL voltageif(P0_7 == 0)//SEL2 = 0 { if((Value>0x01) && (Value<0x07))//Infrared ranging { SensorNum = 24; } if((Value>0x06) && (Value<0x11))//Dot matrix screen { SensorNum = 1; } else if((Value>0x10) && (Value<0x1B))//4-digit digital tube { SensorNum = 2; } else if((Value>0x1A) && (Value<0x26))//High-precision temperature and humidity sensor { SensorNum = 3; } else if((Value>0x25) && (Value<0x31))//Ordinary temperature, photosensitivity, buzzer { SensorNum = 4; } else if((Value>0x30) && (Value<0x3C))//Pressure sensor { SensorNum = 5; } else if((Value>0x3B) && (Value<0x4A))//Relay { SensorNum = 6; } else if((Value>0x49) && (Value<0x56))//Raindrop sensor { SensorNum = 7; } else if((Value>0x55) && (Value<0x59))//Infrared sensor { SensorNum = 8; } else if((Value>0x58) && (Value<0x6A))//Vibration sensor { SensorNum = 9; } else if((Value>0x69) && (Value<0x70))//Acceleration sensor { SensorNum = 10; } else if((Value>0x6F) && (Value<0x7A))//Electricity meter sensor { SensorNum = 21; } } else//SEL2 = 1 { if((Value>0x5) && (Value<0x11))//Combustible gas sensor { SensorNum = 11; } else if((Value>0x10) && (Value<0x1B))//DAC output sensor board { SensorNum = 12; } else if((Value>0x1A) && (Value<0x26))//Infrared temperature sensor { SensorNum = 13; } else if((Value>0x25) && (Value<0x31))//Ultrasonic sensor { SensorNum = 14; } else if((Value>0x30) && (Value<0x3C))//Motor module { SensorNum = 15; } else if((Value>0x3B) && (Value<0x4A))//Hall sensor { SensorNum = 16; } else if((Value>0x49) && (Value<0x56))//High brightness LED control { SensorNum = 17; } else if((Value>0x55) && (Value<0x59))//Flame sensor { SensorNum = 18; } else if((Value>0x58) && (Value<0x6A))//Glass break sensor { SensorNum = 19; } else if((Value>0x69) && (Value<0x70))//Door magnetic sensor { SensorNum = 22; } else if((Value>0x6F) && (Value<0x7A))//Infrared forwarding sensor { SensorNum = 20; } } switch(SensorNum) { case 1://Dot matrix screen IO_DIR_PORT_PIN1(1, 4, IO_OUT);//DT_595 IO_DIR_PORT_PIN1(1, 5, IO_OUT);//LT_595 IO_DIR_PORT_PIN1(1, 7, IO_OUT);//SCK_595 P1_4 = 0; P1_5 = 0; P1_7 = 0; Write595(0X00); Write595(0xff); P1_5 = 1; P1_5 = 0;//No display when restarting LcdPutString16_8(0, 0, (void*)" LED8*8 ", 12 , 1); break; case 2://digital tube IO_DIR_PORT_PIN1(1, 4, IO_OUT);//DT_595 IO_DIR_PORT_PIN1(1, 5, IO_OUT);//LT_595 IO_DIR_PORT_PIN1(1, 7, IO_OUT);//SCK_595 P1_4 = 0; P1_5 = 0; P1_7 = 0; IO_DIR_PORT_PIN1(0, 0, IO_OUT);//WM0 IO_DIR_PORT_PIN1(0, 1, IO_OUT);//WM1 IO_DIR_PORT_PIN1(0, 2, IO_OUT);//WM2 IO_DIR_PORT_PIN1(0, 3, IO_OUT);//WM3 P0 &= 0xf0; LEDDISPFUN(); LcdPutString16_8(0, 0, (void*)" LED*4 ", 12 , 1); break; case 3://High precision temperature and humidity sensor SHT1X_INT(); LcdPutString16_8(0, 0, (void*)" Humidity ", 12 , 1); break; case 4://Normal temperature, light sensitivity, buzzer IO_DIR_PORT_PIN1(1, 6, IO_OUT);//BEEP P1_6 = 1;//OFF IO_DIR_PORT_PIN1(1, 4, IO_OUT);//CS_TC77 IO_DIR_PORT_PIN1(1, 5, IO_OUT);//SCK_TC77 IO_DIR_PORT_PIN1(1, 7, IO_IN);//DAT_TC77 IO_DIR_PORT_PIN1(0, 1, IO_IN);//Lingt P0INP |= 0x02; CS_TC77 = 1; LcdPutString16_8(0, 0, (void*)" Temp/Light ", 12 , 1); break; case 5://Pressure sensor IO_DIR_PORT_PIN1(0, 0, IO_IN);//Pressure P0INP |= 0x01; LcdPutString16_8(0, 0, (void*)" Pressure ", 12 , 1); break; case 6://Relay IO_DIR_PORT_PIN1(1, 4, IO_OUT);//K1 IO_DIR_PORT_PIN1(1, 5, IO_OUT);//K2 P1_4 = 0; P1_5 = 0; LcdPutString16_8(0, 0, (void*)" Relay ", 12 , 1); break; case 7://Raindrop sensor IO_DIR_PORT_PIN1(0, 0, IO_IN);//Raindrop P0INP |= 0x01; LcdPutString16_8(0, 0, (void*)" Raindrop ", 12 , 1); break; case 8://Infrared sensor IO_DIR_PORT_PIN1(0, 0, IO_IN);//Infrared LcdPutString16_8(0, 0, (void*)" Infrared ", 12 , 1); break; case 9://Vibration sensor IO_DIR_PORT_PIN1(1, 4, IO_OUT);//BEEP IO_DIR_PORT_PIN1(0, 0, IO_IN);//Shake PICTL |= 0x08; //Port 0, inputs 3 to 0 interrupt enable. PICTL |= 0x01; //Falling edge on input gives interrupt P0IEN |= 0x01;//Port 0, inputs 0 interrupt enable. IEN1 |= 0x20; //Port 0 interrupt enable P0IFG &= 0xfe; //Clear any pending interrupts LcdPutString16_8(0, 0, (void*)" Shake ", 12 , 1); break; case 10://Acceleration sensor IO_DIR_PORT_PIN1(0, 0, IO_IN);//X-Acceler IO_DIR_PORT_PIN1(0, 1, IO_IN);//Y- Acceler IO_DIR_PORT_PIN1(0, 4, IO_IN);//Z-Acceler P0INP |= 0x13; IO_DIR_PORT_PIN1(1, 4, IO_OUT);//SLEEP IO_DIR_PORT_PIN1(1, 5, IO_OUT);//G-SEL P1_4 = 1;//No Sleep P1_5 = 0;//G-s el=1.5g LcdPutString16_8(0, 0, (void*)"Acceleration", 12 , 1); break; case 11://Combustible gas sensor IO_DIR_PORT_PIN1(0, 0, IO_IN);//ADC IN P0INP |= 0x01; IO_DIR_PORT_PIN1(1, 4, IO_OUT);//SLEEP P1_4 = 1;//Turn on the combustible gas power supply LcdPutString16_8(0, 0, (void*)" Gas ", 12 , 1); break; case 12://DAC HalUARTInit();//Initialize the serial port LcdPutString16_8(0, 0, (void*)" DAC-OUT ", 12 , 1); break; case 13://Infrared temperature sensor IO_DIR_PORT_PIN1(1, 7, IO_IN);//DRDY IN LcdPutString16_8(0, 0, (void*)" TMP006 ", 12 , 1); break; case 14://Ultrasonic sensor IO_DIR_PORT_PIN1(0, 0, IO_IN);//ECHO IN IO_DIR_PORT_PIN1(1, 4, IO_OUT);//TRIG OUT P1_4 = 0; LcdPutString16_8(0, 0, (void*)" Ultrasonic ", 12 , 1); break; case 15://Motor module HalUARTInit();//Initialize serial port LcdPutString16_8(0, 0, (void*)" Motor ", 12 , 1); break; case 16://Hall sensor IO_DIR_PORT_PIN1(0, 0, IO_IN); LcdPutString16_8(0, 0, (void*)" HALL ", 12 , 1); break; case 17://High brightness LED control Timer34int(); PERCFG |= 0x20; //Timer3 pin association P1SEL |= 0x40; P1DIR |= 0x40; P1_6 = 0; //ChangT3Cmp0Val(250); LcdPutString16_8(0, 0, (void*)" LED-LIGHT ", 12 , 1); break; case 18://Flame sensor IO_DIR_PORT_PIN1(0, 0, IO_IN); LcdPutString16_8(0, 0, (void*)" FLAME ", 12 , 1); break; case 19://Glass break sensor IO_DIR_PORT_PIN1(1, 7, IO_OUT); IO_DIR_PORT_PIN1(0, 0, IO_IN); P1_7 = 1; LcdPutString16_8(0, 0, (void*)" GLASS ", 12 , 1); break; case 20://Infrared forwarding sensor HalUARTInit();//Initialize the serial port LcdPutString16_8(0, 0, (void*)" Remote ", 12 , 1); break; case 21://Ammeter sensor IO_DIR_PORT_PIN1(0, 0, IO_OUT); P0_0 = 0; ParitySet = 1; //Check mark position 1 HalUARTInit();//Initialize the serial port LcdPutString16_8(0, 0, (void*)" Ammeter ", 12 , 1); break; case 22://Door magnetic sensor IO_DIR_PORT_PIN1(0, 0, IO_IN); LcdPutString16_8(0, 0, (void*)" Magnetism ", 12 , 1); break; case 24://Infrared distance sensor IO_DIR_PORT_PIN1(0, 0, IO_IN); LcdPutString16_8(0, 0, (void*)" DistanceTest", 12 , 1); break; default: LcdPutString16_8(0, 0, (void*)" No Sensor ", 12 , 1); break; } } //---------------------------------------------------------- //Read Sensor ADC value //Read AD value//Input: channel name//Return: 8-bit AD value//---------------------------------------------------------- INT8U ReadSensorAdc(INT8U channel) { INT8U temp; temp = HalAdcRead(channel,HAL_ADC_RESOLUTION_8); return temp; }
复制代码


31.温度和心率传感器-PulseSensor.pdf

1.54 MB, downloads: 5

This post is from RF/Wirelessly

Latest reply

The original code determines which sensor it is by the voltage range. This ADC port should only be used to identify which module is connected to the baseboard. If you want to add a heart rate module that is not in the official list, you can consider connecting it to another ADC port and compile the algorithm according to the instructions of the heart rate module.  Details Published on 2018-8-17 14:57
 

9703

Posts

24

Resources
2
 
Take a look at the original schematic
This post is from RF/Wirelessly
 
 

301

Posts

2

Resources
3
 
What kind of board is this? So many sensors?
This post is from RF/Wirelessly
 
 
 

6

Posts

0

Resources
4
 
littleshrimp posted on 2018-8-16 21:03 Take a look at the original schematic
Is it the base plate?
This post is from RF/Wirelessly
 
 
 

6

Posts

0

Resources
5
 
dwdsp posted on 2018-8-17 08:21 What kind of board is this? So many sensors?
Modified from the Wireless Dragon comprehensive example code
This post is from RF/Wirelessly
 
 
 

6

Posts

0

Resources
6
 
This is the schematic diagram of the baseboard and 2530

SMBD-V11(pads2007).pdf

66.24 KB, downloads: 3

CC2530 模块.pdf

78.42 KB, downloads: 1

This post is from RF/Wirelessly
 
 
 

9703

Posts

24

Resources
7
 
Which two GPIOs do SEL1 and SEL2 correspond to? "Value = ReadSensorAdc(5); //Collect SEL voltage" corresponds to which pin voltage of ccxxxx?
This post is from RF/Wirelessly
Personal signature虾扯蛋,蛋扯虾,虾扯蛋扯虾
 
 
 

6

Posts

0

Resources
8
 
littleshrimp posted on 2018-8-17 09:28 Which two GPIOs do SEL1 and SEL2 correspond to? "Value = ReadSensorAdc(5);//Collect SEL voltage" corresponds to which pin voltage of ccxxxx?
sel1 and sel2 are p0_5 and p0_7 respectively. The acquisition of p0_5 should be like this
  1. #define IO_DIR_PORT_PIN1(port, pin, dir) \ do { \ if (dir == IO_OUT) \ P##port##DIR |= (0x01<<(pin)); \ else \ P##port##DIR &= ~(0x01<<(pin)); \ }while(0) // Where port={0,1,2}, pin={0,..,7} and dir is one of:
复制代码
This post is from RF/Wirelessly

Comments

P05 and P07 are connected to U11-A, and no other circuits are seen  Details Published on 2018-8-17 11:08
 
 
 

9703

Posts

24

Resources
9
 
Xiao Ouyang posted on 2018-8-17 09:55 sel1 and sel2 are p0_5 and p0_7 respectively. The acquisition of p0_5 should be like this
P05 and P07 are connected to U11-A, and no other circuits are seen
This post is from RF/Wirelessly
Personal signature虾扯蛋,蛋扯虾,虾扯蛋扯虾
 
 
 

1048

Posts

1

Resources
10
 
I haven't seen the schematic diagram, but I guess different sensors are equipped with different voltage divider resistors, so different identification voltages will be generated. This requires the cooperation of software and sensor module.
This post is from RF/Wirelessly
 
 
 

1048

Posts

1

Resources
11
 
The original code determines which sensor it is by the voltage range. This ADC port should only be used to identify which module is connected to the baseboard. If you want to add a heart rate module that is not in the official list, you can consider connecting it to another ADC port and compile the algorithm according to the instructions of the heart rate module.
This post is from RF/Wirelessly
 
 
 

6

Posts

0

Resources
12
 
topwon posted on 2018-8-17 14:57 The original code determines which sensor it is by the voltage value range-------This ADC port should only be used to identify which module is connected to the baseboard? ...
How to add an ADC port
This post is from RF/Wirelessly
 
 
 

Guess Your Favourite
Find a datasheet?

EEWorld Datasheet Technical Support

快速回复 返回顶部 Return list