The project tries to implement DS18B20 digital thermometer interface with PSoC 4. As it is implemented using bit banging, the solution can be portable to other family devices. The DS18B20 digital thermometer provides 9-bit to 12-bit Celsius temperature and communicates over 1-wire protocol. 1-Wire is a device communications bus system that provides low-speed data, signaling, and power over a single conductor. The whole communication is done using the firmware in PSoC4 (master).Project Details
The bit banging implementation of the interface mainly takes care of the tight read and write constraints as per 1 wire protocol. The main constraints taken care in the program are,
- The communication initially starts with a Master pulling down the line for at least 480us, then waiting for the slave to reply before one time frame (60us). The slave presence signal read is done after 30us (half the timeslot) to avoid missing of the presence signal.
- Write operation contains two parts, writing 0 and 1. The time slot during which the line is pulled low varies in each case. This is taken care in the firmware.
- Read is initiated by master pulling the line low for a small duration (atleast 1.5us). Then data should be read before 15us, otherwise invalid.
- All time delays needed between back to back write/read operations are also taken care in the functions. Larger functions are made based on these granular functions.
As the one single pin acts as Tx and Rx, the pin is defined to be in bidirectional mode. The sensor connection status is shown with the help of the RGB LED in PSOC-042 pioneer kit. The receiver data is sent over UART. The USB-UART is used for this functionality.