1
+ # Sensirion Embedded I2C SEN55 Driver
2
+
3
+ This is a generic embedded driver for the Sensirion SEN55 sensor module. It enables developers to communicate with the
4
+ SEN55 sensor module on different hardware platforms by only adapting the I2C communication related source files.
5
+
6
+ <center ><img src =" images/SEN5x.png " width =" 500px " ></center >
7
+
1
8
# Getting started
2
9
10
+ ## Connecting the Sensor
11
+
12
+ Your sensor has the five different connectors: VCC, GND, SDA, SCL, SEL (the sixth connector will not be used for now).
13
+
14
+ <center ><img src =" images/SEN55_pinout.png " width =" 300px " ></center >
15
+
16
+ | * Pin* | * Name* | * Description* | * Comments* |
17
+ | -------| --------| ---------------------------------| ---------------------------------------|
18
+ | 1 | VDD | Supply Voltage | 5V ±10%
19
+ | 2 | GND | Ground |
20
+ | 3 | SDA | I2C: Serial data input / output | TTL 5V and LVTTL 3.3V compatible
21
+ | 4 | SCL | I2C: Serial clock input | TTL 5V and LVTTL 3.3V compatible
22
+ | 5 | SEL | Interface select | Pull to GND to enable I2C interface
23
+ | 6 | NC | Do not connect |
24
+
3
25
## Implement the I2C Interface
4
26
5
27
So we need to adjust two files according to your platform.
6
28
7
29
### Edit ` sensirion_i2c_hal.c `
8
30
9
- This file contains the implementation of the sensor communication, which
10
- depends on your hardware platform. We provide function stubs for your
11
- hardware's own implementation.
12
- Sample implementations are available for some platforms:
13
- [ ` sample-implementations ` ] ( sample-implementations ) . For Linux based platforms
14
- like Raspberry Pi you can just replace the unimplemented HAL template with the
15
- implementation in ` sample-implementations/linux_user_space/ ` :
31
+ This file contains the implementation of the sensor communication, which depends on your hardware platform. We provide
32
+ function stubs for your hardware's own implementation. Sample implementations are available for some platforms:
33
+ [ ` sample-implementations ` ] ( sample-implementations ) . For Linux based platforms like Raspberry Pi you can just replace the
34
+ unimplemented HAL template with the implementation in ` sample-implementations/linux_user_space/ ` :
16
35
17
36
```
18
37
cp sample-implementations/linux_user_space/sensirion_i2c_hal.c ./
19
38
```
20
39
21
40
### Edit ` sensirion_config.h `
22
41
23
- Skip this part for Linux based platforms since everything is already setup for
24
- this case.
42
+ Skip this part for Linux based platforms since everything is already setup for this case.
25
43
26
- Otherwise you need to check if the libraries ` <stdint.h> ` and ` <stdlib.h> ` are
27
- provided by your toolchain, compiler or system. If you have no idea on how to
28
- do that you can skip this step for now and come back when you get errors
29
- related to these names when compiling the driver.
30
- The features we use from those libraries are type definitions for integer sizes
31
- from ` <stdint.h> ` and ` NULL ` from ` <stdlib.h> ` . If they are not available you
32
- need to specify the following integer types yourself:
44
+ Otherwise you need to check if the libraries ` <stdint.h> ` and ` <stdlib.h> ` are provided by your toolchain, compiler or
45
+ system. If you have no idea on how to do that you can skip this step for now and come back when you get errors related
46
+ to these names when compiling the driver. The features we use from those libraries are type definitions for integer
47
+ sizes from ` <stdint.h> ` and ` NULL ` from ` <stdlib.h> ` . If they are not available you need to specify the following
48
+ integer types yourself:
33
49
34
50
* ` int64_t ` = signed 64bit integer
35
51
* ` uint64_t ` = unsigned 64bit integer
@@ -40,55 +56,47 @@ need to specify the following integer types yourself:
40
56
* ` int8_t ` = signed 8bit integer
41
57
* ` uint8_t ` = unsigned 8bit integer
42
58
43
- In addition to that you will need to specify ` NULL ` . For both we have a
44
- detailed template where you just need to fill in your system specific values.
59
+ In addition to that you will need to specify ` NULL ` . For both we have a detailed template where you just need to fill in
60
+ your system specific values.
45
61
46
62
Now we are ready to compile and run the example usage for your sensor.
47
63
48
64
## Compile and Run
49
65
50
- Pass the source ` .c ` and header ` .h ` files in this folder into your C compiler
51
- and run the resulting binary. This step may vary, depending on your platform.
52
- Here we demonstrate the procedure for Linux based platforms:
66
+ Pass the source ` .c ` and header ` .h ` files in this folder into your C compiler and run the resulting binary. This step
67
+ may vary, depending on your platform. Here we demonstrate the procedure for Linux based platforms:
53
68
54
69
1 . Open up a terminal.
55
70
2 . Navigate to the directory where this README is located.
56
71
3 . Run ` make ` (this compiles the example code into one executable binary).
57
- 4 . Run the compiled executable with ` ./[SENSORNAME]_i2c_example_usage `
58
- 5 . Now you should see the first measurement values appear in your terminal. As
59
- a next step you can adjust the example usage file or write your own main
60
- function to use the sensor.
72
+ 4 . Run the compiled executable with ` ./sen55_i2c_example_usage `
73
+ 5 . Now you should see the first measurement values appear in your terminal. As a next step you can adjust the example
74
+ usage file or write your own main function to use the sensor.
61
75
62
76
# Background
63
77
64
78
## Files
65
79
66
80
### sensirion\_ i2c.[ ch]
67
81
68
- In these files you can find the implementation of the I2C protocol used by
69
- Sensirion sensors. The functions in these files are used by the embedded driver
70
- to build the correct frame out of data to be sent to the sensor or receive a
71
- frame of data from the sensor and convert it back to data readable by your
72
- machine. The functions in here calculate and check CRCs, reorder bytes for
73
- different byte orders and build the correct formatted frame for your sensor.
82
+ In these files you can find the implementation of the I2C protocol used by Sensirion sensors. The functions in these
83
+ files are used by the embedded driver to build the correct frame out of data to be sent to the sensor or receive a frame
84
+ of data from the sensor and convert it back to data readable by your machine. The functions in here calculate and check
85
+ CRCs, reorder bytes for different byte orders and build the correct formatted frame for your sensor.
74
86
75
87
### sensirion\_ i2c\_ hal.[ ch]
76
88
77
- These files contain the implementation of the hardware abstraction layer used
78
- by Sensirion's I2C embedded drivers. This part of the code is specific to the
79
- underlying hardware platform. This is an unimplemented template for the user to
80
- implement. In the ` sample-implementations/ ` folder we provide implementations
81
- for the most common platforms.
89
+ These files contain the implementation of the hardware abstraction layer used by Sensirion's I2C embedded drivers. This
90
+ part of the code is specific to the underlying hardware platform. This is an unimplemented template for the user to
91
+ implement. In the ` sample-implementations/ ` folder we provide implementations for the most common platforms.
82
92
83
93
### sensirion\_ config.h
84
94
85
- In this file we keep all the included libraries for our drivers and global
86
- defines. Next to ` sensirion_i2c_hal.c ` * it's the only file you should need to
87
- edit to get your driver working.*
95
+ In this file we keep all the included libraries for our drivers and global defines. Next to ` sensirion_i2c_hal.c ` * it's
96
+ the only file you should need to edit to get your driver working.*
88
97
89
98
### sensirion\_ common.[ ch]
90
99
91
- In these files you can find some helper functions used by Sensirion's embedded
92
- drivers. It mostly contains byte order conversions for different variable
93
- types. These functions are also used by the UART embedded drivers therefore
94
- they are kept in their own file.
100
+ In these files you can find some helper functions used by Sensirion's embedded drivers. It mostly contains byte order
101
+ conversions for different variable types. These functions are also used by the UART embedded drivers therefore they are
102
+ kept in their own file.
0 commit comments