Giter Club home page Giter Club logo

rs485-uart-echotest's Introduction

RS485-UART-EchoTest

Version: 1.0 Date: 2020-12-21

This sketch is useful for debugging and testing RS485/UART wirings. Often the remote device is mounted somewhere on a rooftop or another inconvenient place. That's where this tool comes in and offers you a simulation for your lab.

It was intentionally made for the wind direction sensor: https://github.com/AndreasExner/iobroker-IoT-WindSensor

But it can be used for different purposes as well.

Configuration

#define SERIAL_BAUD_RATE 9600 //baud rate for RS485
#define DEBUG_BAUD_RATE 115200 //baud rate for FT232 / serial1

int counter=0;
bool debug = true;


byte windSensorFrame[] = {0x01, 0x03, 0x04, 0x00, 0x5A, 0x00, 0x00, 0x00, 0x00}; // default answer frame for the wind sensor DO NOT CHANGE
byte customFrame[] = {0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; // your custom answer frame (CRC will be calculated automatically)

bool useWindSensorFrame = true; // echos a random wind direction if true, a custom frame or a copy of the incoming frame if false
bool useCustomFrame = false; // echos the custom frame if true, a copy of the incoming frame if false 

int expectedFrameSize = 8; // expected RX frame size

Do not activate useWindSensorFrame and useCustomFrame at the same time or the code will fail! Deactivate both to echo the RX frame back to the sender.

Tested environment

Wiring

rs485-uart-echotest's People

Contributors

andreasexner avatar

Watchers

 avatar

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.