Giter Site home page Giter Site logo

andrea1388 / arduinomodbushomeassistant Goto Github PK

View Code? Open in Web Editor NEW
6.0 2.0 5.0 10 KB

Arduino sketch for modbus implementation of sensor, switch and thermostat to use with Home Assistant

C++ 100.00%
arduino homeassistant modbus modbus-rtu thermostat ds18b20 home-automation home-assistant

arduinomodbushomeassistant's Introduction

ArduinoModBusHomeAssistant

Also giva a look at this instructables page https://www.instructables.com/Arduino-for-a-Wired-Home-Assistant-Network/

Arduino sketch for modbus implementation of sensor, switch and thermostat to use with Home Assistant. This code make the arduino (I've used an a 5V nano) act a Modbus device than can be connected to a Home Assistant controller. Connectione can be made via a usb cable or via 485 bus. Only in this mode you can connect more than a device and with long cables (more than 1000m). Home Assistant deals with 4 types of device:

  • binary sensors (digital readonly inputs)
  • Temperature sensors
  • Switch (or coils in Modbus language: digital output that can also be read)
  • Climate (a block that act as a thermostat)

This arduino can be 1 or all of these object: it can be a temperature sensor if a sensor is connected. Can be a Climate (sensor also needed). Can read up to 16 inputs and control up to 16 outputs (this arduino have less this number of pins). The temperature read by sensor is mapped in the current_temp_register that can be read by HA. Inputs and outputs are mapped to binary_inputs register and binary_outputs register respectively.

See electical schematic for details.

This hardware can serve to many goals: it can be a headless remote actuator (a switch) to control a load (a lihgt, a motor, etc) it can be a headless remote sensor for temperature reading of to check magnetic sensors it can have a display and buttons to show temperature or control lighs or other devices

Modbus registers map All registers are 16 bits wide

reg# reg name function 0 TARGET_TEMP_REGISTER_LOW setpoint temperature 1 TARGET_TEMP_REGISTER_HIGH 2 CURRENT_TEMP_REGISTER_LOW current tempperature read by sensor 3 CURRENT_TEMP_REGISTER_HIGH 4 BINARY_INPUTS read the inputs connected (read only) 5 BINARY_OUTPUTS read and set the outputs connected 6 BINARY_OUTPUTS_LIGHTS read and set the outputs connected (a light output is also controlled by a pin connected to a switch button)

arduinomodbushomeassistant's People

Contributors

andrea1388 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

arduinomodbushomeassistant's Issues

tx rx pin

Hi, i can't figure out how to declare pin for tx and rx, i can find only the DE/RE pin
Can you explain?

Thanks!
Alessandro

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.