Tag Archives: Arduino

Using an ATmega328 without a crystal

Here is another guide from David Johnson-Davies @ technoblogy.com explaining how to program an ATmega328 on a breadboard using the Arduino IDE. The guide is focused on how to use the internal clock of the microcontroller and how to achieve this using the Arduino environment. By default Arduino IDE doesn’t include a Boards option for an ATmega328 without an external crystal, so here is how to add this support.

Proto Board Power Supply

David Johnson-Davies @ technoblogy.com build a breadboard friendly power supply to power your Arduino or other low power electronics. The power supply is able to deliver 0V to 5.5V at up to 0.5A and it’s powered from two Li-Ion rechargeable batteries. The output can be adjusted using a rotary encoder, and the voltage is displayed on a three-digit 7-segment display. The whole circuit is controlled by an ATmega328.

DevDuino – Learn and Explore Arduino World

DevDuino is a Fully Redesigned and Enhanced Arduino-Compatible Board with Plenty of Must-Have Features. It features a 128×64 OLED display, along with a variety of LED indicators, RTC module, a slot for a micro SD card, and many other convenient features. The project is live on kickstarter and has 29 days to go. [via]

DevDuino – Learn and Explore Arduino World – [Link]

Arduino Weather Station with DHT11 and BMP180

In the previous tutorial I showed you how to build a weather station using only the DHT11 sensor and I said the readings from this sensor is fairly accurate. In this tutorial, I will be using the DHT11 to measure only the humidity and BMP180 to measure pressure and temperature. That’s because its readings are more accurate than the DHT11 temperature readings.

Arduino Weather Station with DHT11 and BMP180 – [Link]

Nerdonic Atom X1 is the World’s Smallest 32-bit Arduino Compatible Board

Tiny 32-bit Dev Board. 14.9mm², Breadboard, 0.95g, 3-20V input, I²C, 8 PWM, Serial, 6 ADC, Prog LED.

There is a new board in the ecosystem which claims to be the world’s smallest 32-bit Arduino board. The name of it Atom X1 and measures 14.9×14.9 mm.

Atom X1 specifications:

  • MCU – Microchip Atmel  SAMD21 Cortex M0+ MCU @ 48 MHz with 256KB flash, 32KB SRAM
  • I/Os via 2x 5-pin 2.54mm pitch headers
    • Up to 8x digital I/O
    • Up to 8x PWM
    • Up to 6x analog (ADC)
    • 1x UART
    • 1x I2C
    • 1x reset
    • Limits – 3.7V, 7mA
  • USB – 1x micro USB port
  • Programming – via micro USB port or SWD header
  • Misc – Power LED, user LED, button
  • Power Supply
    • 3.3-20V (regulated to 3.3v) via power Pin 1
    • 3.3V via power pin 2
    • 5V (regulated to 3.3v) via Micro USB port
    • Current Draw Atom X1 = ~10mA
  • Dimensions – 14.9 x 14.9 x 4.4mm
  • Weight – 0.95 grams

The board is breadboard compatible, pre-flashed with Arduino Zero bootloader, and can be programmed in the Arduino IDE just like the original board.

The project has been launched on Indiegogo. Early bird rewards start at 10 GBP (~$13.2 US) for the board with shipping adding 2 GBP to the UK, and 7 GBP to the rest of the world. Delivery is scheduled for December 2017.

Three Ways to Make Arduino Works As A USB/TTL Converter

Even if you have years working with electronics, you will still find some simple hacks that you never thought about before. Personally and to save money, when I was a student with a very limited budget I knew that my Arduino UNO can work as a USB/TTL(serial) converter. I used to remove the Atmega328P from my Arduino UNO R3 board in order to use the board as a converter not as a development board.

Why we need to do some tweaking to Arduino in order to use 0 and 1 pins for direct USB <-> UART conversion? This is because of what’s called fan-out (fan-out of a logic gate output is the number of gate inputs it can drive). In Arduino UNO case, the RX & TX lines (pins 0 and 1) are connected to FT232RL/Atmega8U2 USB to TTL bridge and to the Atmega328P MCU (check the schematic). So using the same pins with an external connections without doing any changes to Arduino UNO board probably won’t work.

Patel Darshil over Hackster.io listed three ways to make Arduino works as a USB/TTL converter:

Hack #1: Set Pin 0&1 Mode to Input Mode

This is done using code:

Pin Mode Set Arduino

But why this solves the problem? Well, GPIO can operate in two modes, input and output. In the input mode the equivalent impedance of the pin is too high; therefore, the Arduino/Atmega328P’s pins will have almost no electrical effect to the converter RX/TX pins.

Hack #2: Keep Atmega in Reset Mode

Just connect the RES pin with GND (the bold red wire in the image bellow)

Arduino Reset
Image Courtesy of Patel Darshil

GPIOs are configured using special registers. For example, Atmega has GPIO port data direction register (DDR) to set the GPIO as an input or an output for each port. The value of this register is cleared during reset. Therefore, the MCU’s GPIOs mode will be input. This means high impedance, subsequently.

Hack #3: Remove The MCU

This is the common way used by most Arduino UNO users, but it’s not applicable when it comes to new versions of Arduino; where, the MCU is SMD and can’t be removed.

Arduino Two-Way Bluetooth Communication Tutorial

Welcome to another Arduino Tutorial! Today we are going to learn how to use Bluetooth to exchange data between two Arduino boards! As a demonstration project, we are going to build a simple weather station. There is a lot to cover so let’s get started!

Arduino Two-Way Bluetooth Communication Tutorial – [Link]

Decoding and Encoding JSON with Arduino or ESP8266

In this blog post you’re going to learn how to decode (parse a JSON string) and encode (generate a JSON string) with the ArduinoJson library using the Arduino with the Ethernet shield. This guide also works with the ESP8266 and ESP32 Wi-Fi modules with small changes.

Decoding and Encoding JSON with Arduino or ESP8266 – [Link]

Control a 12V Lamp via SMS with Arduino

In this tutorial we’re going to show you how you can turn a 12V lamp on and off by sending SMS to your Arduino with the text “ON” and “OFF”, respectively. You can also request the current lamp state by sending an SMS with the text “STATE”, the Arduino should reply back with the text “Lamp is on” or “Lamp is off”

Control a 12V Lamp via SMS with Arduino – [Link]

Get Sensor Data From Arduino To Smartphone Via Bluetooth

Hariharan Mathavan at allaboutcircuits.com designed a project on using Bluetooth to communicate with an Arduino. Bluetooth is one of the most popular wireless communication technologies because of its low power consumption, low cost and a light stack but provides a good range. In this project, data from a DHT-11 sensor is collected by an Arduino and then transmitted to a smartphone via Bluetooth.

Required Parts

  • An Arduino. Any model can be used, but all code and schematics in this article will be for the Uno.
  • An Android Smartphone that has Bluetooth.
  • HC-05 Bluetooth Module
  • Android Studio (To develop the required Android app)
  • USB cable for programming and powering the Arduino
  • DHT-11 temperature and humidity sensor

Connecting The Bluetooth Module

To use the HC-05 Bluetooth module, simply connect the VCC to the 5V output on the Arduino, GND to Ground, RX to TX pin of the Arduino, and TX to RX pin of the Arduino. If the module is being used for the first time, you’ll want to change the name, passcode etc. To do this the module should be set to command mode. Connect the Key pin to any pin on the Arduino and set it to high to allow the module to be programmed.

Circuit to connect HC-05 with Arduino
Circuit to connect HC-05 with Arduino

To program the module, a set of commands known as AT commands are used. Here are some of them:

AT Check connection status.
AT+NAME =”ModuleName” Set a name for the device
AT+ADDR Check MAC Address
AT+UART Check Baudrate
AT+UART=”9600″ Sets Baudrate to 9600
AT+PSWD Check Default Passcode
AT+PSWD=”1234″ Sets Passcode to 1234

The Arduino code to send data using Bluetooth module:

//If youre not using a BTBee connect set the pin connected to the KEY pin high
#include <SoftwareSerial.h>
SoftwareSerial BTSerial(4,5); 
void setup() {
 String setName = String("AT+NAME=MyBTBee\r\n"); //Setting name as 'MyBTBee'
 BTSerial.print("AT\r\n"); //Check Status
 while (BTSerial.available()) {
 BTSerial.print(setName); //Send Command to change the name
 while (BTSerial.available()) {
void loop() {}

Connecting The DHT-11 Sensor

To use the DHT-11, the DHT library by Adafruit is used. Go here to download the library. When the letter “t” is received, the temperature, humidity, and heat index will be transmitted back via Bluetooth.

circuit to connect DHT-11 with Arduino
circuit to connect DHT-11 with Arduino

The code used to read data from the DHT sensor, process it and send it via Bluetooth:

#include "DHT.h"
#define DHTPIN 2 
#define DHTTYPE DHT11 
void setup() {

void loop()
{ char c; 
 c = Serial.read(); 
void readSensor() {
 float h = dht.readHumidity();
 float t = dht.readTemperature();
 if (isnan(h) || isnan(t)) {
 Serial.println("Failed to read from DHT sensor!");
 float hic = dht.computeHeatIndex(t, h, false);
 Serial.print("Humidity: ");
 Serial.print(" %\t");
 Serial.print("Temperature: ");
 Serial.print(" *C ");
 Serial.print("Heat index: ");
 Serial.print(" *C ");

Developing The Android App

The flow diagram of the Android app is illustrated below,

Flow diagram of the Android app
Flow diagram of the Android app

As this app will be using the onboard Bluetooth adapter, it will have to be mentioned in the Manifest.

uses-permission android:name="android.permission.BLUETOOTH"

Use the following code to test if Bluetooth adapter is present or not,

BluetoothAdapter bluetoothAdapter=BluetoothAdapter.getDefaultAdapter();
if (bluetoothAdapter == null) {
Toast.makeText(getApplicationContext(),"Device doesnt Support Bluetooth",Toast.LENGTH_SHORT).show();

The following part of the code deals with reading the data,

int byteCount = inputStream.available();
 if(byteCount > 0)
 byte[] rawBytes = new byte[byteCount];
 final String string=new String(rawBytes,"UTF-8");
 handler.post(new Runnable() {
 public void run()

To send data, pass the String to the OutputStream.


The complete source code of the Android application is attached here:  Arduino Bluetooth(Source)


Power up the Arduino and turn on the Bluetooth from your mobile. Pair with the HC-05 module by providing the correct passcode – 0000 is the default one. Now, when “t” is sent to the Arduino, it replies with the Temperature, Humidity, and Heat Index.

the application screen
the application screen