Coder Social home page Coder Social logo

ormsport / toshibacarrierhvac Goto Github PK

View Code? Open in Web Editor NEW
14.0 4.0 4.0 33.72 MB

This library can make Arduino/NodeMCU communicate with Toshiba/Carrier HVAC System via serial communication through wifi adapter port.

C++ 100.00%
airconditioning arduino arduino-library carrier esp32 esp8266 heatpump home-assistant home-automation hvac

toshibacarrierhvac's Introduction

ToshibaCarrierHvac

This library can make Arduino/NodeMCU communicate with Toshiba/Carrier HVAC System via serial communication through wifi adapter port. You can use this library to implement the smart home system, control your HVAC remoteless via internet or LAN, automation, etc.

Tested working on:

  • ESP8266
  • ESP32
  • ATmega328P (Arduino Uno R3, Arduino Nano)

Supported HVAC models:

  • Toshiba Seiya
  • Toshiba Shorai
  • Carrier X Inverter (42TVAA)

And might support (not tested yet):

  • Carrier Color Smart (42TVCA)
  • Carrier X Inverter Plus (42TVAB)

Supported features:

  • Power ("off", "on")
  • Setpoint (17-30c)
  • Mode ("auto", "cool", "heat", "dry", "fan_only")
  • Fan mode ("quiet", "lvl_1", "lvl_2", "lvl_3", "lvl_4", "lvl_5", "auto")
  • Swing (vertical) ("off", "on")
  • Pure ("off", "on")
  • Power select ("50%", "75%", "100%")
  • Operation ("normal", "high_power", "silent_1", "eco", "silent_2")
  • Room temperature
  • Outside temperature
  • On/off timer status ("off", "on")
  • CDU status (run, stop)

Header & Connector pinout

See images here

Sample Circuit (ESP01-adapter)

Note: If using ESP8266 or ESP32 please always use with TTL level shifter (5V to 3.3V TTL)

ESP01-adapter Circuit

How to use

1) Include library to your sketch

#include <ToshibaCarrierHvac.h>

2) Set port you want to use

  • Hardware serial
ToshibaCarrierHvac hvac(&Serial);
  • Software serial
ToshibaCarrierHvac hvac(D5, D6); // RX, TX

3) Add handleHvac to loop

void loop() {
    hvac.handleHvac();
}

Global data structures

  • Settings structure
struct hvacSettings {
    const char* state;
    uint8_t setpoint;
    const char* mode;
    const char* swing;
    const char* fanMode;
    const char* pure;
    const char* powerSelect;
    const char* operation;
};
  • Status structure
 struct hvacStatus {
    int8_t roomTemperature;
    int8_t outsideTemperature;
    const char* offTimer;
    const char* onTimer;
    bool running;
};

Functions

  • Get all current status from structure
hvacStatus newStatus = hvac.getStatus;
  • Get all current settings from structure
hvacSettings newSettings = hvac.getSettings;
  • Get only one function
hvac.getState();
hvac.getSetpoint();
hvac.getMode();
hvac.getFanMode();
hvac.getSwing();
hvac.getPure();
hvac.getOffTimer();
hvac.getOnTimer();
hvac.getPowerSelect();
hvac.getOperation();
  • Apply a preset
hvacSettings myPreset {
    "on",    // State ["off", "on"]
    25,      // Setpoint [16-30c]
    "cool",  // Mode ["auto", "cool", "heat", "dry", "fan_only"]
    "on",    // Swing ["off", "on"]
    "lvl_3", // Fan mode ["quiet", "lvl_1", "lvl_2", "lvl_3", "lvl_4", "lvlL_5", "auto"]
    "off",   // Pure ["off", "on"]
    "100%",  // Power select ["50%", "75%", "100%"]
    "normal" // Operation ["normal", "high_power", "silent_1", "eco", "silent_2"]
};

hvac.applyPreset(myPreset);
  • Set only one function
hvac.setState("on");
hvac.setSetpoint(25);
hvac.setMode("cool");
hvac.setfanMode("lvl_3");
hvac.setSwing("off");
hvac.setPure("on");
hvac.setPowerSelect("100%");
hvac.setOperation("normal");
  • Boolean status (true or false)
hvac.isConnected();
hvac.isCduRunning();

Callback Functions

Set your callback function in setup. See more example in UseCallback.ino

void hvacCallback(hvacStatus newStatus) {
    if (newStatus.roomTemperature > 30) hvac.setState("on");
}

void setup() {
    hvac.setStatusUpdatedCallback(hvacCallback);
}

Status Updated Callback

This will callback when any status updated and return structure of current status (acStatus).

hvac.setStatusUpdatedCallback(YourCallbackFunction);

Settings Updated Callback

This will callback when any setting updated and return structure of current settings (acSettings).

hvac.setSettingsUpdatedCallback(YourCallbackFunction);

Update Callback

This will callback when any status or any settings updated but doesn't return anything.

hvac.setUpdateCallback(YourCallbackFunction);

Which Function Updated Callback

This will callback when any status or any setting updated and return name of updated function.

hvac.setWhichFunctionUpdatedCallback(YourCallbackFunction);

Send custom packet

The custom packet size must be 8 to 17 bytes. This function just send your packet without checking anything so please carefully use.

byte myPacket[] = {2, 0, 3, 144, 0, 0, 9, 1, 48, 1, 0, 0, 0, 2, 163, 65, 76};
hvac.sendCustomPacket(myPacket, sizeof(myPacket));

Making a prototype board

Use KiCad to design a prototype board. The cost of components and PCB is around $2.5/pices.

  • Schematics. prototype schematics

  • PCB prototype pcb

  • Wiring prototype wiring

  • Final prototype

TO DO:

  • Send custom packet
  • Prototype board
  • Callback function for debug

toshibacarrierhvac's People

Contributors

ormsport avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  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.