Search in The Electromania's Blog

Sunday 13 December 2015

Home built IR Remote receiver or Demodulator using Phototransistor - working with Arduino Due


My IR receiver module from Banggood bangged after first run - it just ceased working. The next new one will come a months later, but the show must go on....

So thought of trying custom built temporary IR Receiver Demodulator module using available photo-transistor BPW 77NB and standard NPN amplifier transistor PN2222A. 
Note that in circuit diagram i have shown LEDs connected to pin 5,6,7 only, but practically i have connected one more bi-color LED to pin 3 and 4. This was just as fun for my kid.



And to my surprise it worked :)



Final sketch is given below or is available on my GitHub page here..
https://github.com/Electromania/Arduino-Due/blob/master/Quick-Projects/IR%20Remote%20kit%20Arduino%20Due%20using%20Phototransistor 

Currently, the range of IR receiving was only upto 12-15 inches, may be by fine tuning the gain of amplifier transistor or photodetector, it can be increased. I am not an electronics engg... no idea how to do it. Any ideas or suggestions are most welcomed. 

Till then... have fun.... the show must go on... :)

-Original Library from - https://github.com/enternoescape/Arduino-IRremote-Due
-Initial circuit of BPW77NB from-
https://www.youtube.com/watch?v=XsHnvvSzr1M
-Sketch modified by Electromania Dec 2015 

Sunday 6 December 2015

ESP8266 ESP-12E nodemcu 1.0 Getting started with Esplorer - Loading latest firmware - Lua sketch for onboard and external LED blinking


We will be connecting the NodeMCU to PC, Installing Esplorer IDE, Uploading Latest firmware and a test sketch to blink onboard LED and externally connected LED.


*Programming IDE - esplorer available at http://esp8266.ru/esplorer/  or   https://github.com/4refr0nt/ESPlorer  

*Firmware flasher to update firmware- https://github.com/nodemcu/nodemcu-flasher/blob/master/Win64/Release/ESP8266Flasher.exe 

*Firmware- https://github.com/nodemcu/nodemcu-firmware/releases 

I have used -  nodemcu_float_0.9.6-dev_20150704.bin firmware

*Pin configuration of nodemcu V 1.0: https://github.com/nodemcu/nodemcu-devkit-v1.0

NOTEJust plug USB cable between your PC and Nodemcu - no additional hardware modifications or power supply are required.

Unlike other ESP8266 modules,
while flashing firmware, loading sketches, running in normal operations, NO NEED of changing any pin configuration (e.g. pulling high or low pin 0 ,2 etc), NodeMCU E12 dev kit does everything internally. 






The final code to test onboard LED at gpio0 and externally connected LED ,red, at gpio1-pin D1. 

just copy and paste following code in esplorer scripts window and press Send to ESP
--/////////////////////////////////////////Start of Code//////////////////////////////////////////////////////////////
function blinktest()
    for i = 1, 10, 1 do       -- blink LED 50 times
    gpio.write(0, gpio.HIGH)  -- note onboard Blue LED is OFF when GPIO0 is high.
    gpio.write(1, gpio.HIGH)  -- RED LED is ON when GPIO1 is high.
     print("Red ON ",i)
    tmr.delay(500000) -- wait for 0.5 sec = 500 000 micro-sec
    gpio.write(0, gpio.LOW)  -- note onboard Blue LED is ON when GPIO0 is Low.
    gpio.write(1, gpio.LOW)  -- -- RED LED is OFF when GPIO1 is low.
      print("Red OFF ",i)
    i = i + 1;
    tmr.delay(500000)  -- wait for 0.5 sec = 500 000 micro-sec
    end
end

function testnodemcu()

blinktest()
tmr.delay(10000)  -- wait for 10micorsec
print("Congratulations for your first successfull NODEMCU E12 LED blink Test")
gpio.write(0, gpio.HIGH)  -- swtich OFF Blue LED at the end
end


testnodemcu()  -- function to run the test script
--///////////////////END of CODE///////////////////////////////



Sunday 29 November 2015

ESP8266 ESP-12E nodemcu 1.0 SPI OLED Display 128x64 on using U8Glib with esplorer a Non-Arduino IDE

After several days of struggle...finally managed to get 4pin SPI OLED display running on ESP8266  ESP-12E nodemcu 1.0 dev. kit, using esplorer, a Non-Arduino IDE.

The beginning of fun with powerful ESP8266  ESP-12E nodemcu 1.0 Wifi dev kit.



Please note, the display arrived with pin markings that are different than those shown on their website.

 Pin connections between ESP8266-12E  and SPI OLED display
     -- D3 pin of ESP to RES pin of Display
     -- D4 pin of ESP to DC pin of Display
     -- D5 pin of ESP to SCL pin of Display  Hardware SPI CLK  = GPIO14
     -- D7 pin of ESP to SDA pin of Display  Hardware SPI MOSI = GPIO13



--** Same pin out can be used to run the default U8Glib library graphics code available here.

ESP8266 ESP-12 Nodemcu dev kit V 1.0-
http://eu.banggood.com/Wholesale-Warehouse-NodeMcu-Lua-ESP-12E-WIFI-Development-Board-wp-Uk-985891.html 

Display- 0.96 inch 4 pin SPI OLED display with 64x128 resolution
http://eu.banggood.com/Wholesale-Warehouse-0_96-Inch-White-IIC-I2C-OLED-Display-Module-12864-LED-For-Arduino-wp-Uk-932606.html


Note- I dont get any royalty from banggood for these projects, I mention this because it makes easy for you all to understand exactly which make electronic device I am using and how to make it work :). I noticed every make has different pin markings.

Monday 23 November 2015

Arduino Due and OLED Display using U8GLIB library in SPI mode


Getting started with 0.96 Inch 128x64 White SPI OLED Display Module from Banggood using U8GLIB library on Arduino Due.


Thanks to 32bit microcontroller of Arduino Due, the rendering of animation is superfast, compared to previous 8bit Arduino board versions.



U8GLIB  Universal 8bit Graphics Library https://github.com/olikraus/u8glib/ 

Sketch/code for above quick project is available on my GitHub page here
 
//I used following pin connections, you can use any other free pins of your board but make sure to use same pin numbering while calling the constructor in main code.
// 13 - SCL    or   CLK   13
// 11 - SDA    or   MOSI  
// 8  - RES     or   RESET 8
// 7  - DC       or   DC    7
// 10 - keep open

// U8GLIB_SSD1306_128X64 u8g(13, 11, 10, 9, 8);    //constructor used to call display



Display purchased from banggood.com
http://eu.banggood.com/Wholesale-Warehouse-0_96-Inch-White-IIC-I2C-OLED-Display-Module-12864-LED-For-Arduino-wp-Uk-932606.html

Arduino Due and OLED Display using Adafruit library in SPI mode

Getting started with 0.96 Inch 128x64 White SPI OLED Display Module fusing Adafruit library on Arduino Due.

Thanks to 32bit microcontroller of Arduino Due, the rendering of animation is superfast, compared to previous 8bit Arduino board versions.

Sketch/Code is available on my GitHub page here

Adafruit library:https://github.com/adafruit/Adafruit_SSD1306


//I used following pin connections, you can use any other free pins of your board but make sure to use same pin numbering while calling the constructor in main code.
// 13 - SCL     or  OLED_CLK
// 11 - SDA    or  OLED_MOSI  
// 8  - RES      or  OLED_RESET
// 7  - DC        or  OLED_DC  
// 10 - keep open


Display purchased from banggood.com
http://eu.banggood.com/Wholesale-Warehouse-0_96-Inch-White-IIC-I2C-OLED-Display-Module-12864-LED-For-Arduino-wp-Uk-932606.html
Note-I do not get any royalty from above links and purchases you do.

Arduino Due and OLED Display using U8GLIB library in SPI mode- Getting started


Getting started with 0.96 Inch 128x64 White SPI OLED Display Module using U8GLIB library and Arduino Due.

Thanks to 32bit microcontroller of Arduino Due, the rendering is superfast, compared to previous 8bit Arduino board versions.

Sketch/Code is available on my GitHub page here

Universal 8bit Graphics Library,
https://github.com/olikraus/u8glib/

//I used following pin connections, you can use any other free pins of your board.
// 13 - SCL
// 11 - SDA
// 8  - RES
// 7  - DC
// 10 - keep open

Display purchased from banggood.com
http://eu.banggood.com/Wholesale-Warehouse-0_96-Inch-White-IIC-I2C-OLED-Display-Module-12864-LED-For-Arduino-wp-Uk-932606.html

IR remote kit LED blink using Arduino Due


IR remote kit LED blink using Arduino Due

Original library available at- https://github.com/enternoescape/Arduino-IRremote-Due  

Led connected to pin 7 of Arduino due
IR receiver photo-detector connected to pin 11

Modified code for this project is-----

//#include "global_def.h"  // These don't seem to work.  They should.
//#include "ms_remote_map.h" // These don't seem to work.  They should.
#include <IRremote2.h>

//#define ms_remote_map.h

#define RECV_PIN 11
#define LED_PIN 7 // choose the pin for the LED

byte ledState;
IRrecv irrecv(RECV_PIN);
decode_results results;
boolean power_state = LOW;

void setup(){
  Serial.begin(9600);
  irrecv.enableIRIn(); // Start the receiver
  pinMode(LED_PIN, OUTPUT);  // declare LED as output
  pinMode(RECV_PIN, INPUT);  // declare LED as output
}

void loop() {
  if (irrecv.decode(&results)) {  //If IR receive results are detected
     Serial.println(results.value, HEX);
   
    if (results.value == 0x143226DB)
     {
     
       digitalWrite(LED_PIN, HIGH);
       delay(1000);
       digitalWrite(LED_PIN, LOW);
     
     }

    delay(200);  // 1/5 second delay for arbitrary clicks.
    irrecv.resume(); // Receive the next value
  }
}

Contact Electromania

Name

Email *

Message *