Project showcase
Peltier Controlled From An Android App

Peltier Controlled From An Android App © GPL3+

Arduino temperature control sketch, managed from an Android.

  • 8,527 views
  • 1 comment
  • 14 respects

Components and supplies

Apps and online services

About this project

This is another example project of the Abetoo IoT Framework. In this case an application for remote control of an arduino-based circuit from an android app. The arduino board used is based on the popular module esp8266. The main goal of the application is to control a Peltier element, a Fan and to show messages sent from the android app. A board with relays is used to activate/deactivate both the Peltier element and the fan. A LCD is used to show the messages received.

PinOut of the NodeMCU V3 board (esp8266 + usb-232):

In the schematic is also used a Relays PCB and a LCD:

Fritzing of the whole project:

And here are the results:

Code

tutorial_relays.inoArduino
/*
    Sample program to manage relays a receive messages
    Copyright (C) 2017  Chocron J.

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/  
#include <LiquidCrystal.h>
#include "abtoo.h"

// Relays
int r1 = 16; // GPIO16
int r2 = 5;  // GPIO5
int r3 = 4;  // GPIO4

// LCD
int rs = 0;  // GPIO0
int en = 2;  // GPIO2
int d4 = 14; // GPIO14
int d5 = 12; // GPIO12
int d6 = 13; // GPIO13
int d7 = 15; // GPIO15

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);

// WiFi
char* ssid = "MYSSID";
char* password = "MYPASSWORD";
AbetooIno abtoino;

// Message received callback
void messageReceived(String message)
{
  if (message == "r1on")
  {
    digitalWrite(r1, LOW);
  }
  else if (message == "r1off")
  {
    digitalWrite(r1, HIGH);
  }
  else if (message == "r2on")
  {
    digitalWrite(r2, LOW);
  }
  else if (message == "r2off")
  {
    digitalWrite(r2, HIGH);
  }
  else // text message
  {
    lcd.setCursor(0,1);
    lcd.print(message+"                ");
  }
}

void setup() {
  // Initialize pins
  pinMode(rs, OUTPUT);
  pinMode(en, OUTPUT);
  pinMode(d4, OUTPUT);
  pinMode(d5, OUTPUT);
  pinMode(d6, OUTPUT);
  pinMode(d7, OUTPUT);

  // Initialize LCD
  lcd.begin(16, 2);
  lcd.setCursor(0,0);
  lcd.print("Abetoo IoT");
  lcd.setCursor(0,1);
  lcd.print("Arduino Library");

  Serial.begin(9600);
  delay(10);

  // Initialize Relay's pins
  pinMode(r1, OUTPUT);
  pinMode(r2, OUTPUT);
  pinMode(r3, OUTPUT);
  digitalWrite(r1, HIGH);
  digitalWrite(r2, HIGH);
  digitalWrite(r3, HIGH);
 
  // Connect to WiFi network
  Serial.println();
  Serial.println();
  Serial.print("Connecting to ");
  Serial.println(ssid);
 
  WiFi.begin(ssid, password);
 
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }
  Serial.println("");
  Serial.println("WiFi connected");

  abtoino.init("uuid1", "-TbVO-rqdA0iWg6-gWh0eeQ636243460528994051#735acf9cd6eda96e66ee3858496dca59d750aff1", 1, messageReceived);
}

void loop()
{
  abtoino.abetooloop();
}

Schematics

Comments

Similar projects you might like

Make an Enhanced R2-D2 to Be Controlled by an Android App

Project tutorial by Kutluhan Aktar

  • 4,258 views
  • 0 comments
  • 3 respects

Create a People Counter Controlled by an Android App

Project tutorial by Kutluhan Aktar

  • 12,402 views
  • 5 comments
  • 9 respects

Android Controlled 6DoF Robotic Arm

Project in progress by Team Mans

  • 17,600 views
  • 0 comments
  • 30 respects

Propeller Display Controlled by Android

Project showcase by Jose Luis Bejarano Vasquez

  • 7,558 views
  • 3 comments
  • 12 respects

Rover Robot Controlled by a Blynk App from a Mobile

Project showcase by Rafa Juárez

  • 5,760 views
  • 0 comments
  • 7 respects
Add projectSign up / Login