Arduino library and sample code for communication with Druck's DPS8000-CANbus and DPS5000-CANbus pressure sensor
dps_can.h is library of byte stream to read/write data from/to DPS pressure sensor.
CANbus-2.ino is sample code to read/write data from/to DPS pressure sensor using terminal software
The library and sample code have been verified to work with Arduino UNO or MEGA and CAN-bus shield which utilizes MCP2515 and MCP2551 chips. Below are CAN-bus shield vendors.
- Seeed Studio : www.seeedstudio.com/CAN-BUS-Shield-V2.html
- Keyestudio : www.keyestudio.com/products/keyestudio-can-bus-shield-mcp2515-chip-with-sd-socket-for-arduino-uno-r3-543
I recommend to use Seeed Studio, because there is only little information on Keyestudio product. Keyestudio CAN-bus shield doesn't work on Arduino MEGA.
On Keyestudio CAN-bus shield, there is no Rdif mounted between CAN-H and CAN-L. You have to mount Rdif by yourself.
Recommended Rdif value is 120Ω, but I use 330Ω instead and it works (Arduino UNO only).
D-Sub 9 pin assignment :
Seeed Studio shield : 2:GND, 3:CAN-HI, 5:CAN-LO
Keyestudio shield : 3:GND, 2:CAN-LO, 7:CAN-HI
MCP_CAN_lib MCP2515 CAN-bus controller library is required. It can be downloaded from repository below https://github.com/coryjfowler/MCP_CAN_lib
Serial Command List
rp : Read Pressure
Command : rp < CRLF >
Reply : Pressure : < Pressure Value > < Pressure Unit > < CRLF >
rt : Read Temperature
Command : rt < CRLF >
Reply : Temperature : < Temperature Value >< Temperature Unit >< CRLF >
rc : Read Pressure and Temperature continuously. Reading will stop when LF is received (Enter button is pressed)
Command : rc < CRLF >
Reply : Pressure: < Pressure Value > < Pressure Unit > , Temp: < Temperature Value >< Temperature Unit >< CRLF >
pn : Read Product No
Command : pn < CRLF >
Reply : Product No. : < Product No. >< CRLF >
rs : Read S/N
Command : rs < CRLF >
Reply : S/N : < Serial Number >< CRLF >
ri : Read NodeID
Command : ri < CRLF >
Reply : NodeID : < NodeID >< CRLF >
ci : Change Sensor NodeID
Command : ci < CRLF >
Reply : Change NodeID. Please type NodeID and press Enter
Send : < NodeID >< CRLF >
Reply : Power cycle the sensor to enable the change.
si : Set NodeID to be read
Command : si < CRLF >
Reply : Set NodeID to be read. Please type NodeID and press Enter
Send : < NodeID >< CRLF >
Reply : NodeID to be read is < NodeID >< CRLF >
rb : Read Bit Rate
Command : rb < CRLF >
Reply : Bit Rate : < Bit Rate >< CRLF >
cb : Change Sensor Bit Rate
Command : cb < CRLF >
Reply : Change Bit Rate. Please type Bit Rate and press Enter
Send : < Bit Rate >< CRLF >
Reply : Power cycle the sensor to enable the change.
sb : Set Host Bit Rate
Command : sb < CRLF >
Reply : Set Host Bit Rate. Please type Bit Rate and press Enter
Send : < Host Bit Rate >< CRLF >
Reply : Host Bit Rate is set to < Host Bit Rate > kpbs < CRLF >
rst : Reset Sensor to Factory Default Setup (don't execute on DPS8000)
rfv : Read Field Value1
rf : Read selected FIR filter
cf : Change FIR filter