Skip to content

Commit c8a58c5

Browse files
authored
drivers: add PCF8583 RPM sensor (#14018)
1 parent 6dc3cbb commit c8a58c5

File tree

9 files changed

+500
-0
lines changed

9 files changed

+500
-0
lines changed

boards/px4/fmu-v5/default.cmake

+1
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ px4_add_board(
5252
px4io
5353
rc_input
5454
roboclaw
55+
rpm
5556
safety_button
5657
tap_esc
5758
telemetry # all available telemetry drivers

boards/px4/fmu-v5x/default.cmake

+1
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ px4_add_board(
5151
px4io
5252
rc_input
5353
roboclaw
54+
rpm
5455
safety_button
5556
tap_esc
5657
telemetry # all available telemetry drivers

msg/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ set(msg_files
9797
power_button_state.msg
9898
power_monitor.msg
9999
pwm_input.msg
100+
rpm.msg
100101
qshell_req.msg
101102
qshell_retval.msg
102103
radio_status.msg

msg/rpm.msg

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
uint64 timestamp # time since system start (microseconds)
2+
3+
float32 indicated_frequency_hz # indicated rotor Frequency in Hz
4+
float32 estimated_accurancy_hz # estimated accurancy in Hz
5+
float32 indicated_frequency_rpm # indicated rotor Frequency in Revolution per minute
6+
float32 estimated_accurancy_rpm # estimated accurancy in Revolution per minute
7+

msg/tools/uorb_rtps_message_ids.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,8 @@ rtps:
281281
id: 125
282282
- msg: logger_status
283283
id: 126
284+
- msg: rpm
285+
id: 127
284286
########## multi topics: begin ##########
285287
- msg: actuator_controls_0
286288
id: 150

src/drivers/rpm/CMakeLists.txt

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
add_subdirectory(pcf8583)
2+
+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
px4_add_module(
2+
3+
MODULE drivers__pcf8583
4+
MAIN pcf8583
5+
COMPILE_FLAGS
6+
SRCS
7+
pcf8583.cpp
8+
DEPENDS
9+
drivers__device
10+
)

src/drivers/rpm/pcf8583/parameters.c

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/**
2+
* PCF8583 rotorfreq (i2c) pool interval
3+
*
4+
* @reboot_required true
5+
* @group Sensors
6+
* @unit us
7+
*/
8+
PARAM_DEFINE_INT32(PCF8583_POOL, 1000000);
9+
10+
/**
11+
* PCF8583 rotorfreq (i2c) i2c address
12+
*
13+
* @reboot_required true
14+
* @group Sensors
15+
* @value 80 0x50
16+
* @value 81 0x51
17+
*/
18+
PARAM_DEFINE_INT32(PCF8583_ADDR, 80);
19+
20+
/**
21+
* PCF8583 rotorfreq (i2c) counter reset value
22+
*
23+
* Internal device counter is reset to 0 when overun this value,
24+
* counter is able to store upto 6 digits
25+
* reset of counter takes some time - measurement with reset has worse accurancy
26+
*
27+
* @reboot_required true
28+
* @group Sensors
29+
* @value 0 - reset avter every measurement
30+
*/
31+
PARAM_DEFINE_INT32(PCF8583_RESET, 500000);
32+
33+
/**
34+
* PCF8583 rotorfreq (i2c) magnet count
35+
*
36+
* Nmumber of signals per rotation of rotor
37+
*
38+
* @reboot_required true
39+
* @min 1
40+
*/
41+
PARAM_DEFINE_INT32(PCF8583_MAGNET, 2);

0 commit comments

Comments
 (0)