Coder Social home page Coder Social logo

hc06_at_commandcenter's Introduction

HC-05/06 AT Command Center

Arduino library for simplifying AT command configuration of HC-05/06 devices over UART.

Version 2.0

Overview

Description: Simple HC05/06 AT configuration library for Arduino. Requires 2nd UART (Serial1) defined. Full repo can be found at HC06_AT_CommandCenter. Reference site for this library can be found here.

Provides user menu for selecting configuration changes. Automatically identifies device (HC-05 or HC-06), firmware version, baud and parity settings. Serial1 automatically configured to match HC-05/06 UART settings. HC-05/06 must be in configuration mode (AT mode) (LED blinking to indicate Not Connected).


HC06 connections (for 5V boards - resistors not needed for 3V3):
            TXD -----------------> [Serial1 RX]
            RXD <----+---R_1K----- [Serial1 TX]
                     |
                     |
                   R_2K
                     |
                    \|/
                    Vss

HC05 connections: same as above, but also include (for AT mode selection):
            STATE  -----------------> [State pin]
            EN/KEY <----+---R_1K----- [Mode pin]
                        |
                        |
                      R_2K
                        |
                       \|/
                       Vss

Command mode (AT mode):
Device LED should be blinking fast (> 2 Hz) when in command (AT) mode.
When LED is solid, device is paired and connected.
If LED is blinking slowly (HC-05), device is in fixed AT mode. In this mode, UART baud rate is fixed at 38400 with no parity. This occurs when EN/KEY pin is tied HIGH while power is connected. For this reason, [Mode pin] will be set to INPUT mode when not communicating AT commands. If LED is blinking slowly, try disconnecting and reconnecting power to HC-05 device.

Pin connections:
                board        Mega    MKR   Uno WiFi  Zero    Due    MSP432
  -------------------+-------------------------------------------------------
    [Serial1 RX]     |        19      13      0        0      19       3 
    [Serial1 TX]     |        18      14      1        1      18       4 

Recent batches of HC-06 appear to have HC-05 firmware (reporting Version 3). There is no documentation of a Version 3 firmware for HC-06. AT commands differ for HC-05 firmware, including CR+NL command terminators. Support for this version has been added beginning with Revision 1 of this software.

AT response delays:
Around 10~25ms for Version 3.x (newline terminated) - max observed 35ms
Around 500ms for Version 1.x (timeout terminated) - max observed 525ms
Serial writes are asynchronous, so delays must also consider write time

History

  Created on: 18-Oct, 2021
  Author: ndroid ([email protected])

    Modified: 09-Oct, 2023
    Revision: 2.0.1
            * corrects UART failure following detectDevice() failure (Issue #6)
    Modified: 25-Sep, 2023
    Revision: 2.0
            * added support and auto-detection for HC-05
            * defined classes for interfacing HC-0x devices
    Modified: 22-Apr, 2023
    Revision: 1.0
            * added support and auto-detection for firmware versions
                1.x and 3.x
    Modified: 24-Apr, 2022
    Revision: 0.4
            * added option to auto-detect firmware version and UART 
                configuration
    Modified: 7-Feb, 2022
    Revision: 0.3
            * updated end-line characters to support devices with newer
                firmware (3.0+) HC-05 firmware?
    Modified: 30-Jan, 2022
    Revision: 0.2
            * provides user menu for selecting desired configuration

License

Up to version 0.4.0, the license is GPLv3. From version 1.0.0, the license is the MIT license.

Copyright

Copyright (c) 2021-2023 chris miller (https://github.com/ndroid)

hc06_at_commandcenter's People

Contributors

ndroid avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Forkers

stmb-100

hc06_at_commandcenter's Issues

'Serial1' was not declared in this scope

Hi
I get a lot of error messages like this when compiling the example for the HC-05

...libraries\HC0x_AT_Config\src\configureBT.cpp:157:5: error: 'Serial1' was not declared in this scope
Serial1.print(lineEnding[FIRM_VERSION2]);
LG
Stefan

Serial1.end duplication

If detectDevice() ends with no device detected, the last call to Serial1 if Serial1.end(), but uartBegun is still set to true. Therefore, subsequent calls to detectDevice() will result in repeated call to Serial1.end() which may produce fault in board packages which don't check for Serial status before executing end().

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.