BLYNK
HOME       📲 GETTING STARTED       📗 DOCS       ❓HELP CENTER       👉 SKETCH BUILDER

Emulate an Arduino remote control & send WiFi signals to an IR transceiver

I’m a bit confused by this!

GPIO4 (which is what you’re specifying with:

Is the pin labelled “D2” on the D1 Mini (and NodeMCU).
The pin labelled “D4” is GPIO2…

image

Pete.

Typo; I corrected it. GPIO4 indicates pin D2 for the Wemos Mini.
Stayed up late last night working and finishing everything off. Z-z-z-z …
UNDERCON

1 Like

That web page with the ESP pinouts was nice. Here are the pinouts for the Wemos D1 Wifi card it was missing (below). It has the footprint of an Arduino Uno, the same mounting dimensions and power/USB connections. It fits nicely in a low-profile Arduino acrylic project case. Gone are all the plug-board wires; there are only 3 extra connections to a (KeyStudio) LED module that has a nice SMD LED to show you when it gets triggered by the Blynk code running inside the WiFi chip on the Wemos board. I don’t need to do a custom PCB board for the Wemos Mini; this will work just fine.
Project completed.

Your next mission (should you choose to accept it) is to add OTA update capability.
You include the OTA library and a few lines of code, then install Python on your PC.
When you’ve done that, the board doesn’t need to be physically connected to your PC’s serial port, you upload the new code wirelessly, over your local network.

For me, this is one of the major advantages of the ESP based boards. It means that you can box them up and tuck them neatly away out of sight and when you want to make a small tweak to the code you don’t have to pull everything apart to re-flash them.

Pete.

1 Like

Sure, I’ll go to the next Jedi level; send me a few links on what’s to do.
I won’t get to it immediately, because I’m playing with my new
NEC Remote Control WiFi to IR transceiver project just completed.
Thanks,
Mike

This is a good place to start…
https://arduino-esp8266.readthedocs.io/en/latest/ota_updates/readme.html#arduino-ide

Pete.

Screenshots are OS related. We have no control of this feature.

Project completed, and I successfully cloned the iPhone Blynk remote control layout to my iPad. I was even able to enable HotSpot mode on my iPhone and use it instead of my home router to connect.
What am I using WiFi for? Remote control of my two digital Himalayan salt lamps. They have 12 selectable luminary programs driven by an Arduino UNO sequencing high-intensity digital LED arrays:

1 Like

Hey, Pavel, I’ve been online for 107 days now, messaging Pete about my next project, an Arduino controlled camera slider using stepper motors. When do I earn my 100-day badge?

Update: Ignore; the badge was finally granted based on increased activity here.

The system giveth the badges as it sees fit… based on algorithms I guess.

And based on my past badges, I suspect you need to be online (and active?) for 100 consecutive days.

Apparently, I had no life :innocent: way back when, in order to achieve this badge…

image

I haven’t been as “diligent” over the last year… yet I still have no "normal :crazy_face: " life… hmmmm… :thinking:

1 Like

Yup…

image

Keep at it though, and you can end up as craz… er… devoted as others :innocent:

I actually tried to make one over 5 years ago… when I really didn’t have a clue about Arduinos.

I did get fairly close, but due dwindling health I never finished it :frowning:

OK, that explains it. Some days, I’m active, other days I’m just signed on. Yes, you must have had no life in order to get a 365 consecutive day badge, I’ll just keep doing what I’m doing. The camera slider is the easy part; I want to do a Blynk remote control to program it, just like I did for my first project. And I just earned my first “quote” badge here. Cool.

1 Like

Yes, I had the hardware working quite uniquely at the time (long before I saw a later surge on DIY slider projects).

Arduino UNO (no such thing as ESP back then).
Single stepper running a friction based drive, so as to allow swapping out any length of runners.
Portable (ran on 12v battery).
And I even had the code controlled by a physical panel… but it was not very polished as I wanted more fully automatic runtime based on user parameters and such… as well as pan and tilt for the camera itself.

Ah, good memories…

Looking forward to what you have planned :smiley:

2 Likes

You spent a lot of work on that I can see! Pete and I have been messaging back and forth just exchanging information during my startup investigative phase; I haven’t opened this up as a “need help with my project” topic entry. Is there some way I can add you to our message flow so you can follow along? Otherwise I can just create a new topic similar to my Blynk WiFi project completed and working.

I believe either of you (or at least @PeteKnight) can add me to your private topic… just be aware that, while I have been rather consistent lately, it is not my new normal intent to log in every day.

I opened this as a regular Blynk project, so that others besides yourself can follow along. I want to keep personal messaging separate from project messaging. Great pictures of your own camera project.
Hey, @GTT I finally scored my 100-day “Aficionado” badge, after being on here 109 consecutive days, even though some days I was just logged on looking for messages. I guess the Blynk Blog knows when I’m sleeping and when I’m really productive. The Blynk App is complete; I just need to get the Camera Slider commands sent from Blynk to the stepper-motors.

The official project is here now: The Camera Slider Chronicles

1 Like

Final Breadboard layout for the Blynk NEC Remote Control emulation project. The NANO will still accept commands from the Arduino (NEC) remote control as well as via Wifi from the Blynk App. Signal processing starts at (1) and ends up at (6) to drive the salt lamps.

This is the sketch source code for step (5) in the Fritzing diagram above. It sends IR codes received from the Wemos ESP8266 Blynk Message Broker via the Keyes Infrared Transceiver over to the UNO shield driving the Himalayan Salt Lamp shield program. It’s pretty simple for what it does.

// Infrared Comm Receiver sketch for
// Arduino NANO microprocessor talking to UNO shield via Rx/Tx serial print commands.
// Note: UNO must be separated from the NANO to download new code into either board.
// 2019-03-01 initial version.
// 2019-03-14 filter out all invalid RC codes from other remotes.

#include <boarddefs.h>
#include <IRremote.h>
//#include <IRremoteInt.h>
#include <ir_Lego_PF_BitStreamEncoder.h>

unsigned long last = millis(); // timestamp for last IR message
int RECV_PIN = 2;
IRrecv irrecv(RECV_PIN);
decode_results results;
long int IRvalue = 0;
const uint8_t header[2] = { 0x01, 0x02 };

void setup()
{
  Serial.begin(9600);
  irrecv.enableIRIn(); // Start the IR receiver
  pinMode(LED_BUILTIN, OUTPUT); // set pin 13 for output
  digitalWrite(LED_BUILTIN, HIGH);
  delay(500);
  digitalWrite(LED_BUILTIN, LOW);
  delay(500);
  Serial.println();
  Serial.print("NANO IR Comm Receiver 3/14/2019");
  Serial.println();
}
void loop()
{
   if (irrecv.decode(&results)) { //IR event seen ...
     if (millis() - last > 250) { // and 1/4 sec since last one?
        IRvalue = results.value; // yes
        //Serial.print(IRvalue, HEX);  // IR data
        //Serial.println(); // CRLF
        bool validIRkey = false;
        while (true) {
           if ((IRvalue == 0xFFA25D)) {
              validIRkey = true; break; // "1"
              }
           if ((IRvalue == 0xFF629D)) {
              validIRkey = true; break; // "2"
              }
           if ((IRvalue == 0xFFE21D)) {
              validIRkey = true; break; // "3"
              }
           if ((IRvalue == 0xFF22DD)) {
              validIRkey = true; break; // "4"
              }
           if ((IRvalue == 0xFF02FD)) {
              validIRkey = true; break; // "5"
              }
           if ((IRvalue == 0xFFC23D)) {
              validIRkey = true; break; // "6"
              }
           if ((IRvalue == 0xFFE01F)) {
              validIRkey = true; break; // "7"
              }
           if ((IRvalue == 0xFFA857)) {
              validIRkey = true; break; // "8"
              }
           if ((IRvalue == 0xFF906F)) {
              validIRkey = true; break; // "9"
              }
           if ((IRvalue == 0xFF6897)) {
              validIRkey = true; break; // "*"
              }
           if ((IRvalue == 0xFF9867)) {
              validIRkey = true; break; // "0"
              }
           if ((IRvalue == 0xFFB04F)) {
              validIRkey = true; break; // "#"
              }
           if ((IRvalue == 0xFF18E7)) {
              validIRkey = true; break; // "UP"
              }
           if ((IRvalue == 0xff4AB5)) {
              validIRkey = true; break; // "DOWN"
              }
           if ((IRvalue == 0xFF10EF)) {
              validIRkey = true; break; // "LEFT"
              }
           if ((IRvalue == 0xFF5AA5)) {
              validIRkey = true; break; // "RIGHT"
              }
           if ((IRvalue == 0xFF38C7)) {
              validIRkey = true; break; // "OK"
              }
           break;
           }
        if (validIRkey == true) {
           digitalWrite(LED_BUILTIN, HIGH);
           Serial.print(header[0],HEX); // x01 "SOH"
           Serial.print(header[1],HEX); // x02 "STX"
           Serial.print(IRvalue, HEX);  // IR data
           Serial.println(); // CRLF
           digitalWrite(LED_BUILTIN, LOW);
           }
        last = millis();
        irrecv.resume(); // Restart
      }
   }   
}

This is the code for the Blynk Online Message Broker “BOMB” (the WEMOS D1 Mini board) in Fritzing step (3) above sending IR pulses to the NANO receiver emulating an Arduino Remote Control.

/* ************************************************************
  Download latest Blynk library here:
    https://github.com/blynkkk/blynk-library/releases/latest

  Blynk is a platform with iOS and Android apps to control
  Arduino, Raspberry Pi and the likes over the Internet.
  You can easily build graphic interfaces for all your
  projects by simply dragging and dropping widgets.

    Downloads, docs, tutorials: http://www.blynk.cc
    Sketch generator:           http://examples.blynk.cc
    Blynk community:            http://community.blynk.cc
    Follow us:                  http://www.fb.com/blynkapp
                                http://twitter.com/blynk_app

  Blynk library is licensed under MIT license
  This example code is in public domain.

 *************************************************************
  WARNING!
    It's very tricky to get it working. Please read this article:
    http://help.blynk.cc/hardware-and-libraries/arduino/esp8266-with-at-firmware

  This example shows how value can be pushed from Arduino to
  the Blynk App.

  NOTE:
  BlynkTimer provides SimpleTimer functionality:
    http://playground.arduino.cc/Code/SimpleTimer

 ************************************************************ */
 
/* Comment this out to disable prints and save space */
#define BLYNK_PRINT Serial
/* Turn on verbose messaging */
#define BLYNK_DEBUG // Debug - enable verbose mode
#define BLYNK_HEARTBEAT 30
#define BLYNK_NO_FLOAT // Disable floating point operations

// Sketch definitions to run in Arduino:
//#include <ESP8266_Lib.h>
//#include <BlynkSimpleShieldEsp8266.h>
//#include <IRremote.h>
//---------------------------//

// Sketch definitions to run in ESP8266:
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <IRremoteESP8266.h>
#include <IRsend.h>

//---------------------------//

//BlynkTimer timer;
IRsend irsend(4); // An IR led is connected to a GPIO line;
                   // Wemos D1 WIFI R1 Board  GPIO4 -> D4
                   // Wemos D1 MINI Board     GPIO4 -> D2
                   // Adafruit Feather Huzzah GPIO4 -> D4 SDA

// Hardware Serial on Mega, Leonardo, Micro...
//#define EspSerial Serial1
// or Software Serial on Uno, Nano...
//#include <SoftwareSerial.h>
//SoftwareSerial EspSerial(10, 11); // WiFi RX, TX

// Your ESP8266 baud rate:
// #define ESP8266_BAUD 9600

//ESP8266 wifi(&EspSerial);
//BlynkTimer timer;

//int RECV_PIN = 2; // Uno IR receiver
//IRrecv irrecv(RECV_PIN);
//int XMIT_PIN = 3; // Uno IR transmitter
//#define LEDpin 13

// This function sends Arduino's up-time every X seconds to 
// Virtual Pin (21). In the app, the Widget's reading frequency 
// should be set to PUSH. This means that you define how often 
// to send data to Blynk App.
//void myTimerEvent()
//{
  // You can send any value at any time.
  // Don't send more that 10 values per second.
  //Blynk.virtualWrite(V21, millis() / 1000);
//}

// These functions will be called every time Button Widgets
// in Blynk app write values to their Virtual Pin.
BLYNK_WRITE(V1)
{
  irsend.sendNEC(0xFFA25D,32); // "1"
  //delay(1000);
  //Serial.println("1V1");
}
BLYNK_WRITE(V2)
{
  irsend.sendNEC(0xFF629D,32); // "2"
  //delay(1000);
  //Serial.println("2V2");
}
BLYNK_WRITE(V3)
{
  irsend.sendNEC(0xFFE21D,32); // "3"
  //delay(1000);
  //Serial.println("3V3");
}
BLYNK_WRITE(V4)
{
  irsend.sendNEC(0xFF22DD,32); // "4"
  //delay(1000);
  //Serial.println("4V4");
}

BLYNK_WRITE(V5)
{
  irsend.sendNEC(0xFF02FD,32); // "5"
  //delay(1000);
  //Serial.println("5V5");
}

BLYNK_WRITE(V6)
{
  irsend.sendNEC(0xFFC23D,32); // "6"
  //delay(1000);
  //Serial.println("6V6");
}
BLYNK_WRITE(V7)
{
  irsend.sendNEC(0xFFE01F,32); // "7"
  //delay(1000);
  //Serial.println("7V7");
}
BLYNK_WRITE(V8)
{
  irsend.sendNEC(0xFFA857,32); // "8"
  //delay(1000);
  //Serial.println("8V8");
}
BLYNK_WRITE(V9)
{
  irsend.sendNEC(0xFF906F,32); // "9"
  //delay(1000);
  //Serial.println("9V9");
}
BLYNK_WRITE(V10)
{
  irsend.sendNEC(0xFF9867,32); // "0"
  //delay(1000);
  //Serial.println("0V10");
}
BLYNK_WRITE(V11)
{
  if ( param.asInt() != 0 ) { // debounce
    irsend.sendNEC(0xFF18E7,32);// "UP"
    //delay(1000);
  }
}
BLYNK_WRITE(V12)
{
  if ( param.asInt() != 0 ) { // debounce
    irsend.sendNEC(0xFF6897,32); // "ASTERICK"
    //delay(1000);
  }
}
BLYNK_WRITE(V13)
{
  if ( param.asInt() != 0 ) { // debounce
    irsend.sendNEC(0xFF10EF,32); // "LEFT"
    //delay(1000);
  }
}
BLYNK_WRITE(V14)
{
  if ( param.asInt() != 0 ) { // debounce
    irsend.sendNEC(0xFF38C7,32); // "OK"
    //delay(1000);
  }
}
BLYNK_WRITE(V15)
{
  if ( param.asInt() != 0 ) { // debounce
    irsend.sendNEC(0xFF5AA5,32); // "RIGHT"
    //delay(1000);
  }
}
BLYNK_WRITE(V16)
{
  if ( param.asInt() != 0 ) { // debounce
    irsend.sendNEC(0xFFB04F,32); // "#"
    //delay(1000);
  }
}
BLYNK_WRITE(V17)
{
  if ( param.asInt() != 0 ) { // debounce
    irsend.sendNEC(0xFF4AB5,32); // "DOWN"
    //delay(1000);
  }
}
BLYNK_WRITE(V20) // Test Wifi
{
  if ( param.asInt() != 0 ) { // debounce
    digitalWrite(BUILTIN_LED, LOW);  // Turn the LED on (Note that LOW is the voltage level
                                     // but actually the LED is on; this is because 
                                     // it is acive low on the ESP-01)
    delay(250);                      // Wait a bit
    digitalWrite(BUILTIN_LED, HIGH); // Turn the LED off by making the voltage HIGH
  }
}

void setup()
{
  // Set debug console
  Serial.begin(9600);
  delay(100);
  Serial.println(F("BOMB Push Data Demo - 2/09/2020 "));

  // You need Auth Token in the Blynk App.
  // Go to the Project Settings (nut icon).
  // You also need WiFi credentials:
      char auth[] = "Your_Auth";
      char ssid[] = "Your_SSID";
      char pass[] = "Your_Pass";

      Blynk.begin(auth, ssid, pass);

 delay(100);

  pinMode(BUILTIN_LED, OUTPUT);
  digitalWrite(BUILTIN_LED, HIGH); // Turn it off to start

  //Blynk.begin(auth, wifi, ssid, pass); // for Uno
  //Blynk.begin(auth, ssid, pass);
  // You can also specify server:
  //Blynk.begin(auth, wifi, ssid, pass, "blynk-cloud.com", 80);
  //Blynk.begin(auth, wifi, ssid, pass, IPAddress(192,168,1,100), 8080);

  // Setup a function to be called every one second
  //timer.setInterval(1000L, myTimerEvent);
}

void loop()
{
  Blynk.run();   // Fireup the engines ...
  //timer.run(); // Initiates BlynkTimer
}