Using Wemos D1 Mini & Oled Shield

Category : Arduino, Electronics

In this guide I’ll show you how to use the shield and it’s two buttons. Lets get to it.

Resoltion is 64×48
Button A is by default pin D3.
Button B is by default pin D4.

Buttons can be customized by soldering jumper pads under the shield.

Parts:

Wemos D1 Mini @ Aliexpress

Oled Shield @ Aliexpress

PS, be sure to get the shield with A & B buttons when you buy it, there are a few types to choose from.

Code:

There are several libraries to choose from, but I found the one from Sparkfun to be suitable for my use.

Download it, then unzip in libraries folder and restart Arduino IDE. Then paste my code:

#include <Wire.h>  // Include Wire if you're using I2C
#include <SFE_MicroOLED.h>  // Include the SFE_MicroOLED library
 
#define PIN_RESET 255  //
#define DC_JUMPER 0  // I2C Addres: 0 - 0x3C, 1 - 0x3D
 
MicroOLED oled(PIN_RESET, DC_JUMPER); // Example I2C declaration
 
void setup()
{
  // Before you can start using the OLED, call begin() to init
  // all of the pins and configure the OLED.
  oled.begin();
  // clear(ALL) will clear out the OLED's graphic memory.
  // clear(PAGE) will clear the Arduino's display buffer.
  oled.clear(ALL);  // Clear the display's memory (gets rid of artifacts)
 
  pinMode(D4, INPUT); // Setting D4 B Button as input
  pinMode(D3, INPUT); // Setting D3 A Button as input
}
 
void loop()
{
  oled.clear(PAGE);     // Clear the screen
  oled.setFontType(0);  // Set font to type 0
  oled.setCursor(0, 0); // Set cursor to top-left
  oled.print("Line 1");
  oled.setCursor(0, 8); // Set cursor to top-left
  oled.print("Line 2");
  oled.setCursor(0, 16); // Set cursor to top-left
  oled.print("Line 3");
  oled.setCursor(0, 24); // Set cursor to top-left
  oled.print("Line 4");
  oled.setCursor(0, 32); // Set cursor to top-left
  oled.print("Line 5");
  oled.setCursor(0, 40); // Set cursor to top-left
  oled.print("Line 6");
 
 
  if (digitalRead(D4) == LOW)
  {
    oled.setCursor(0, 40); // Set cursor to top-left
    oled.print("B Pushed");
 
  }
 
  if (digitalRead(D3) == LOW)
  {
    oled.setCursor(0, 32); // Set cursor to top-left
    oled.print("A Pushed");
 
  }
  oled.display();
}

You should now see this when buttons are pressed:

Thats it! Now play around with it. Hope this short guide was helpful.

Using Wemos D1 Mini with SHT30 Sensor Shield

Category : Arduino, Electronics

SHT30 is a temperature and humidity sensor, almost the same as DHT22 only much smaller. They also measure a larger range, from -40 to 125 C.

Parts:

What we need is a Wemos D1 Mini board, which can be found on Aliexpress for around 5$. And of course the SHT30 shield can also be found on Aliexpress for a few dollars.

SHT30 @ Aliexpress

Wemos D1 Mini @ Aliexpress

Code:

Next up is installing the Arduino Library for the SHT30, unzip in libraries folder and restart Arduino IDE.

Then in Arduino IDE select the example called SHT30_SHIELD, or use example code below,  just to verify that our sensor is working correctly.

#include <WEMOS_SHT3X.h>
 
SHT3X sht30(0x45);
 
void setup() {
 
  Serial.begin(115200);
 
}
 
void loop() {
 
  if(sht30.get()==0){
    Serial.print("Temperature in Celsius : ");
    Serial.println(sht30.cTemp);
    Serial.print("Temperature in Fahrenheit : ");
    Serial.println(sht30.fTemp);
    Serial.print("Relative Humidity : ");
    Serial.println(sht30.humidity);
    Serial.println();
  }
  else
  {
    Serial.println("Error!");
  }
  delay(1000);
 
}

Then open up the serial monitor and you should see it reporting temperature and humidity:

Thats it! Now play around with it. Hope this short guide was helpful.

Guide: Flashing Hobbywing Skywalker 20A ESC with BLHeli Firmware

Category : Arduino, Electronics, RC

This guide will tell you step by step how to flash a Hobbywing 20A esc with BLHeli firmware for multirotors. It will be the same procedure for any other ESC with a silabs chip, you just need to find the pin-outs for it. Well lets get started.

You will need the following:

Arduino (UNO, Nano etc. I use a Mega 1280 in this guide)
Three wires (I used some male to female jumper wires)
Soldering-iron with a tiny tip
OlliW`s flash-toolkit

Step 1:

Attach your selected Arduino board to your computers USB and run the following file from the OlliW toolkit “AvrBurnTool_vxxx.exe”. Choose the type of Arduino board and select it’s COMport, then click the button “Burn All”. This will burn the flashing-tool onto your Arduino board, you can use your Arduino board for other sketches later, this will not make your board useless for other tasks.

A CMD window will popup and let you know the flashing is in progress and then done. Just close the AvrBurn tool and the CMD window. Lets move onto next step!

Step 2.

Remove the plastic wrapping around your ESC, and get familiar with the soldering points as show in the next picture (click on the picture to see a larger one).

 

Now solder on the three jumper wires onto the pads shown in the picture above. The GND can be very tricky to solder, but after some try and fail I noticed it doesn’t need to be soldered exactly where the picture shows, but you can use the GND(black) at the servo-cable connection. Or generally any other GND. The red and white are easier, just put some tin on them first, then while you heat the wire, attach it!

It should look something like the picture below.

 

Then we attach the three wires onto the Arduino boards ISCP header, as shown in the picture below.

Step 3.

We are now almost ready to flash the ESC, but before we do so the ESC needs a lipo battery connected. Needs to be powered on while flashing. The start the file  “BLHeliTool_v100.exe” and choose your ESC make, model, type. As shown in the picture below.

 

Or choose the firmware file directly “BLHeliHexFiles\SKYWALKER_20A_MULTI_REV9_3.HEX “, and hit Flash!

If everything went smooth it should say “Flash hex file… DONE!” 🙂 To verify this click the “Setup Basic” tab and select READ, this will tell you the firmware type.

HAPPY FLASHING!

PS! At the moment 9_3 firmware will cause “twitches” when used on the Skywalkers, a new fix is in the works. And will be released in a matter of days.

UPDATE: v10 firmware is now available, check out this link.

 

Bad quality shield bought on eBay

Category : Arduino, Electronics

I was looking for some cheap shields for my Arduino board, and stumbled across a very inexpensive proto shield. A well known seller with good reputation had it laying around for only 7,65 $, so it couldn’t be that bad.

Well, after a couple of weeks it arrived in the mail. And here are a few things I noticed:


Looks like it’s rusted and kind of old?


Not even close to nice solderings…


Some plastic is melted off? 😛

Well, its not worth that much and it actually works, but for how long?

Whats most annoying is how the seller can say that its Quality and New!

 

DHT11 Library for Arduino 1.0

2

Category : Arduino, Electronics

DHT11 is a cheap and easy to use temperature and humidity sensor. But since it’s digital and only uses one pin there is a great library for it!

Of course it has some problems compiling on Arduino 1.0 and the one I found on the arduino.cc playground had problems. So I modified it, and put both the library and the example in a nice and easy to unzip package. The example sends data on serial back to the pc, so it looks like this when posting results:

Credit goes to the arduino playground for the library and example code.

Download Arduino DHT11 Sensor Library

Tutorial: C# Communicating with Arduino over Serial

10

Category : Arduino, Electronics, Windows

In this tutorial I’ll try to show you how to easily tell an arduino what to do from a C# program using serial communication. The only thing the C# program does is send a byte to the arduino, and the arduino program will then set pin 13 to HIGH or LOW.

Lets start with the C# sourcecode, it’s written in C# Express 2010 which you can download for free here. Get the C# project files:

Download CSharpEasySerialSource.zip

I tried to comment the code so that it should explain most of the stuff going on. But it’s pretty basic, you select the current comport then hit Connect. If you selected the correct port that the arduino is using it should now be connected. The textbox only takes numbers, writing text there will only result in it being converted to bytes.

When you click Send it will try to send the contents of the textbox to the arduino. In my example code I used “0” and “1” for turning off an on the LED. Lets look at the Ardunio example:

What the program does it’s listening on the serial port. And when it receives a “1” pin 13 goes HIGH, and if it receives “0” it goes LOW. Pin 13 is in most cases a LED thats on the arduino board, so you only need a bare arduino to test it. And if you don’t know any C# and just want to use the program to control a arduino I’ve created a zip file containing only the .exe file for the program:

Download CSharpEasySerial.zip

Arduino, LEDs that blinks to the Music!

3

Category : Arduino, Electronics

I always wanted to make something out of the microphone sensor I got, it’s just been laying in a compartment-box until recently when I got the idea of a music beat blinker.

Basically it just reads the analog value from the mic and converts it to a 0-1023 value, but since the microphone sensor I got is meant for 12 volts, it only ranges from 0 – 5-600 on 5 volts. But it works just as good, only it’s not as sensitive as it should be. When playing music that is never a problem hehe.

The microphone sensor I use is one I found on eBay some time ago, just search for “Arduino Sound Sensor Module” they cost around 5$. And are very easy to use, only ground it and feed it with 5 volts and stick the output to a analog input on the Arduino. I’ll also post the program code for the Arduino, it’s the same thats used in the video below. If you want to make something like this yourself using my example, you only need 5 LEDs or more. And just wire them to the digital pins 2-5, and of course the mic to analog 0. Code example can be found in the bottom of this article.

Here is a video showing the LEDs blinking to the music.

Program code example:

 

Cheap arduino nano from DX!

Category : Arduino, Electronics

Looking for yet another cheap & tiny arduino?

For only 16.90$ you get a Arduino Nano V3 clone from dealextreme!
Ever since modified electronics stopped making the pico I’ve been looking for another arduino in the same price range and size, and now dx got just the right one.

– Digital I/O Pins: 12 (D2~D13)
– Analog Input Pins: 8 (A0~A7)
– TTL serial data receive and transmit pins: RX/TX
– PWM Output Pins: 6 (D3/D5/D6/D9/D10/D11)
– Microcontroller: Atmel Atmega328P-AU
– Small mini-B USB for programming and serial monitor (cable included)
– Supports external 5V~12V DC power supply or 9V battery
– ICSP header for direct program download
– Cable length: 108cm

 

Ultrasonic HC-SR04 Sensor

Category : Arduino, Electronics

I’ve stumbled by this neat little sonar sensor on eBay a few days ago, I’ve had some bad experiences with other similiar ultrasonic sensors so I was kind of skeptic to this one. But for the low price I couldn’t resist. Anyhow, it turned out to be a great sensor. It’s accurate down to 1 cm, which is perfect and in most cases more than enough. You get it for around 5$ on eBay.

 

Only problem I ran into when using it with arduino was the library, got some nasty compiling errors. So I changed a few lines in the library and made it work with Arduino 1.0 and older arduino IDEs.

Download HC-SR04 Library for Arduino 1.0

Also wrote a little example for using it with a serial display:

 

How to make a security alarm using LDR and Laser!

1

Category : Arduino, Electronics

How about a easy and simple tutorial on how to make a sort of security sensor using laser and a light dependent resistor?

It’s just as simple as this, the LDR reacts when it gets less light than the laser-dot in the center of it. Which is when something comes in the lasers way. So then you know when something passes the invisible line between the laser and the LDR.

Lets begin with what components you need:

1x Laser Emitter/Pen
1x LDR
1x Resistor 10k (doesn’t have to be 10k ohms)
1x Piezo Buzzer (you can use a LED or anything else you want)

And of course a Arduino board of your choice, and some wires.

Lets wire it all up like this:

Things to notice, buzzer is grounded and the + wire is on the digital 10. Laser is just ground and +5v to make it light constantly. The LDR is in a voltage divider with a resistor, we take out the readings in the middle where the yellow wire is, and it’s attached to the analog 0.

A picture of the LDR.¨

When all this is wired up, just put this code and run it.

[youtube=http://www.youtube.com/watch?v=IzEDspdWjxU;ap=%2526fmt%3D18&w=425&h=344]