Giter Site home page Giter Site logo

esp32-bacnetserverexample's Introduction

ESP32 BACnet Server Example

In this project we are using the CAS BACnet stack to generate a simple BACnet server with one Multi-state-value (MSV) object. The MSV shows the current mode of the built-in LED. A BACnet client (such as the CAS BACnet Explorer) can be used to write to this MSV to change the mode.

The MSV allows for three possaible values to be written.

  • 1 = Off
  • 2 = On
  • 3 = Blink - Blinks the LED on and off at a rate of 500 ms.

Quick start

  1. Download and install Platform/io for Visual studios code
  2. Add the ESP32 board to Platform/io
  3. Move the CAS BACnet stack source and adapter files to the /lib/src/ folder:
From:
|--lib
|  |
|  |--cas-bacnet-stack
|  |  |--adapters
|  |  |  |--cpp
|  |  |  |  |- *.cpp
|  |  |  |  |- *.h
|  |  |--source
|  |  |  |- *.cpp
|  |  |  |- *.h
|  |  |--submodules
|  |  |  |--cas-common
|  |  |  |  |--source
|  |  |  |  |  |- *.cpp
|  |  |  |  |  |- *.c
|--src
|  |- main.c

To:
|--lib
|  |
|  |--cas-bacnet-stack
|  |  |--src
|  |  |  |- *.cpp
|  |  |  |- *.h
|--src
|  |- main.c
  1. Use Platform/io to Build the project.
  2. Use Platform/io to Upload and Monitor.

Supported BIBBs

The CAS BACnet stack supports many other BIBBs, this minumial example only supports the following:

  • DS-RP-B: Data Sharing - ReadProperty-B
  • DS-RPM-B: Data Sharing - ReadPropertyMultiple-B
  • DS-WP-B: Data Sharing - WriteProperty-B
  • DM-DDB-B: Device and Network Management - Dynamic Device Binding-B (Who-Is)
  • DM-DOB-B: Device and Network Management - Dynamic Object Binding-B (Who-Has)

BACnet objects supported

The CAS BACnet stack supports many other object types this minumial example only supports the following:

  • Device (8)
  • Multi-state Value (19)

Device Tree

Below is the device tree exported from the CAS BACnet Explorer.

device: 389001  (ESP32 BACnet Example Server)
    object_identifier: device (389001)
    object_type: device
    vendor_identifier: Chipkin Automation Systems (0x185)
    application_software_version: v1
    firmware_revision: 3.25.0.0
    model_name: CAS BACnet Stack
    object_name: ESP32 BACnet Example Server
    protocol_services_supported: readProperty (1), readPropertyMultiple (1), writeProperty (1), who_Has (1), who_Is (1), 
    protocol_version: 1
    vendor_name: Chipkin Automation Systems
    protocol_revision: 14
    multi_state_value: 1  (LED State)
        object_identifier: multi_state_value (1)
        object_type: multi_state_value (0x13)
        event_state: normal (0x0)
        number_of_states: 3
        object_name: LED State
        out_of_service: False
        present_value: 3
        status_flags: in_alarm (0), fault (0), overridden (0), out_of_service (0), 
        state_text: Off, On, Blink

Example in the CAS BACnet Explorer

Preview of the CAS BACnet Explorer

Example output

The example output from the serial terminal of the ESP32

FYI: ESP32 CAS BACnet Stack example version: 0.0.1
FYI: ESP32 Chip ID: 30C6, (08A4AE30)
FYI: Connecting to wifi...
FYI: Connected to XXXXXXXXXX
FYI: IP address: 192.168.1.66
FYI: Connecting UDP resource to port=[47808]
FYI: Connected to UDP port.
FYI: CAS BACnet Stack version: 3.25.0
FYI: BACnet device created: Device instanse=389001
FYI: Enabled WriteProperty for Device 389001
FYI: Enabled Read Property Multiple for Device 14
FYI: Added multi-state-output (1) to Device (389001)
FYI: CallbackGetPropertyUInt deviceInstance=389001, objectType=8, objectInstance=389001, propertyIdentifier=62
FYI: CallbackGetPropertyUInt deviceInstance=389001, objectType=8, objectInstance=389001, propertyIdentifier=120
FYI: Sent message with 25 bytes to 192.168.1.255:47808
FYI: Sent broadcast IAm message
FYI: FreeHeap: 270784 / 336136 (80.59 %)
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
FYI: Recived message with 19 bytes from 192.168.1.77:47808
FYI: CallbackGetPropertyUInt deviceInstance=389001, objectType=19, objectInstance=1, propertyIdentifier=74
FYI: CallbackGetPropertyCharString deviceInstance=389001, objectType=19, objectInstance=1, propertyIdentifier=77
FYI: CallbackGetPropertyUInt deviceInstance=389001, objectType=19, objectInstance=1, propertyIdentifier=85
FYI: CallbackGetPropertyUInt deviceInstance=389001, objectType=19, objectInstance=1, propertyIdentifier=110
FYI: CallbackGetPropertyCharString deviceInstance=389001, objectType=19, objectInstance=1, propertyIdentifier=110
FYI: CallbackGetPropertyCharString deviceInstance=389001, objectType=19, objectInstance=1, propertyIdentifier=110
FYI: CallbackGetPropertyCharString deviceInstance=389001, objectType=19, objectInstance=1, propertyIdentifier=110
FYI: Sent message with 98 bytes to 192.168.1.77:47808
FYI: FreeHeap: 270784 / 336136 (80.59 %)
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

Tested hardware

FAQ

Can't build the project. CASBACnetStackAdapter.h: No such file or directory

Please see this issue CASBACnetStackAdapter.h: No such file or directory

esp32-bacnetserverexample's People

Contributors

funvill avatar justin-wong-ce avatar mochiman avatar ssmethurst avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

esp32-bacnetserverexample's Issues

ESP32 BACnet Support for controlling water valve

Hi Chipkin,

As we are planning to design circuit which is having ESP32,we required to control external water valve which is supported only BACnet communication.
As we are new in BACnet communication can you please suggest any solution for ESP32 to control BACnet supported valve ?

CASBACnetStackAdapter.h: No such file or directory

When compiling the project using Visual studios Code with Platform.io I get the following error message.

Error message

src\main.cpp:26:57: fatal error: ..\lib\casbacnetstack\CASBACnetStackAdapter.h: No such file or directory

Full build output

> Executing task: C:\Users\XXXXXXX\.platformio\penv\Scripts\platformio.exe run <

Processing featheresp32 (platform: espressif32; board: featheresp32; framework: arduino)
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/featheresp32.html
PLATFORM: Espressif 32 > Adafruit ESP32 Feather
HARDWARE: ESP32 240MHz 320KB RAM (4MB Flash)
DEBUG: CURRENT(esp-prog) EXTERNAL(esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF MODES: FINDER(chain) COMPATIBILITY(soft)
Collected 27 compatible libraries
Scanning dependencies...
Dependency Graph
|-- <WiFi> 1.0
Compiling .pioenvs\featheresp32\src\main.cpp.o
Generating partitions .pioenvs\featheresp32\partitions.bin
Compiling .pioenvs\featheresp32\lib152\WiFi\ETH.cpp.o
Compiling .pioenvs\featheresp32\lib152\WiFi\WiFi.cpp.o
Compiling .pioenvs\featheresp32\lib152\WiFi\WiFiAP.cpp.o
src\main.cpp:26:57: fatal error: ..\lib\casbacnetstack\CASBACnetStackAdapter.h: No such file or directory

*****************************************************************************************************
* Looking for ..\lib\casbacnetstack\CASBACnetStackAdapter.h dependency? Check our library registry!
*
* CLI  > platformio lib search "header:..\lib\casbacnetstack\CASBACnetStackAdapter.h"
* Web  > https://platformio.org/lib/search?query=header:..%5Clib%5Ccasbacnetstack%5CCASBACnetStackAdapter.h
*
*****************************************************************************************************

Where do I get the ..\lib\casbacnetstack\CASBACnetStackAdapter.h file ?

Ethernet example

From @f4natik as posted in a merge request #5

Hi,

This is working perfect in a ESP32-Poe from Olimex (via wifi)

Can you do a example, using only Ethernet (this board includes it) or arduino
ethernet shield.

Will be a great example for automation (wifi is almost no-used in production enviroments)

I have try to edit EthernetUDP.h in VSCode with no-luck :/

A simple working example, will be appreciated. (With no-wifi)

Best reggards!

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.