PIC16 Temperature sensor with RS485 communication
The microcontroller waits for a request signal on the RS485 bus and when a request is received, it sends back the temperature read from a temperature sensor.
The PIC16F1826 microcontroller has two active parts: the ADC converter and the UART module. The UART module is connected to a MAX483 chip which listens for incoming messages on a RS485 serial bus. The PIC then waits for a request signal on the RS485 bus and when a request is received, it sends back the temperature (read from an LM35 temperature sensor connected to the ADC) on the same serial bus.
The PIC16 was programmed using the MPLAB X IDE and the ICD3 programmer.
The power supply is provided by a switching voltage regulator (LM2594N) which requires an input between 12V to 45V, and outputs 5V. Actually the 12V lower bound can be relaxed, as I have almost always powered the circuit with a 9V battery and it worked anyway.
There is a led connected to the RS485 transmit enable pin so to see when the circuit is transmitting data. There is also a general purpose led connected to port B4 to be used for example to signal a particular state related to the sensor (high temperature, etc.)