Friday, June 29, 2018

Entangled Minds by Dean Radin - Book Review

This was my first book I finish reading about metaphysics and paranormal.

I have been attracted to the book title as it combines the scientific thinking with Neuroscience and the Quantum Mechanics.


The term Entangled which refers to Quantum Entanglement as a proposed explanation to many Extra Sensory Perception ESP phenomena.

Those Phenomena include Telepathy, Clairvoyance and Precognition.

The book is informative as a whole and has lightened many areas about ESP.

It encouraged me to read other books from the author as I will publish later.


Monday, June 25, 2018

Cool and Simple Arduino Metal Detector

We all love Arduino and look for cool ways to make new stuff with it.
This post is dedicated to our Facebook Page fan AbdUllah Hanfy . Thank you for sharing ideas about new ways of using Arduino. If anyone has a new idea about using Arduino in a new or productive circuit don't hesitate to share or ask.
This post is about Metal Detector Circuit. It's about using Arduino as the main controller for the Metal Detector.

I've searched the web and found many circuits of Metal Detectors. Some are as simple as built around the famous 555 timer IC and some are based on Arduino and others are so sophisticated with LCD touch screens.

I believe in simplicity in electronic circuits. Here I'm introducing a fairly simple yet efficient Arduino Metal Detector.

It's simple that it uses limited number of components. And it's efficient as it does its function in detecting metal in fail accuracy and giving visual and audible indications.
I hope you like it. So let's get started.

Theory of operation


This Metal Detector operates using the self inductance in different metals. As the coil comes near a magnetic metal such as Iron, the coil inductance increases and as the coil comes near a non magnetic material such as Copper, the inductance decreases.

As a rule of thumb, the detector is sensitive to objects at a distance or depth up to the radius of the coil. It is most sensitive to objects in which a current can flow in the plane of the coil, and the response will correspond to the area of the current loop in that object.

The function of the circuit is continuous measurement of the coil impedance and determining the presence of metal of both types.

Components

Arduino UNO R3
10nF capacitor
Small signal diode, e.g. 1N4148
220-ohm resistor
For power:
USB power bank with cable
For visual output:
2 LEDs of different colour e.g. blue and green
2 X 220Ohm resistors
For sound output:
Passive buzzer
Microswitch to disable sound
For earphone output:
Earphone connector
1 k Ohm resistor
Earphones
To easily connect/disconnect the search coil:
2 pin screw terminal
For the search coil:
~5 meters of thin electric cable
Structure to hold the coil. Must be stiff but does not need to be circular.
For the structure:
1 meter stick, e.g wood, plastic or selfie stick.

The Coil

Nearly 20 turns of wire.

Connections

 

Circuit

 

Final Assembly

 

Software


// Metal detector
// Runs a pulse over the search loop in series with resistor
// Voltage over search loop spikes
// Through a diode this charges a capacitor
// Value of capacitor after series of pulses is read by ADC

// Metal objects near search loop change inductance.
// ADC reading depends on inductance.
// changes wrt long-running mean are indicated by LEDs
// LED1 indicates rise in inductance
// LED2 indicates fall in inductance
// the flash rate indicates how large the difference is

// wiring:
// 220Ohm resistor on D2
// 10-loop D=10cm seach loop between ground and resistor
// diode (-) on pin A0 and (+) on loop-resistor connection
// 10nF capacitor between A0 and ground
// LED1 in series with 220Ohm resistor on pin 8
// LED2 in series with 220Ohm resistor on pin 9

// First time, run with with serial print on and tune value of npulse
// to get capacitor reading between 200 and 300

const byte npulse = 3;
const bool sound = true;
const bool debug = false;

const byte pin_pulse=A0;
const byte pin_cap =A1;
const byte pin_LED1 =12;
const byte pin_LED2 =11;
const byte pin_tone =10;

void setup() {
if (debug) Serial.begin(9600);
pinMode(pin_pulse, OUTPUT);
digitalWrite(pin_pulse, LOW);
pinMode(pin_cap, INPUT);
pinMode(pin_LED1, OUTPUT);
digitalWrite(pin_LED1, LOW);
pinMode(pin_LED2, OUTPUT);
digitalWrite(pin_LED2, LOW);
if(sound)pinMode(pin_tone, OUTPUT);
if(sound)digitalWrite(pin_tone, LOW);
}

const int nmeas=256; //measurements to take
long int sumsum=0; //running sum of 64 sums
long int skip=0; //number of skipped sums
long int diff=0; //difference between sum and avgsum
long int flash_period=0;//period (in ms)
long unsigned int prev_flash=0; //time stamp of previous flash

void loop() {
int minval=1023;
int maxval=0;

//perform measurement
long unsigned int sum=0;
for (int imeas=0; imeas<nmeas+2; imeas++){
//reset the capacitor
pinMode(pin_cap,OUTPUT);
digitalWrite(pin_cap,LOW);
delayMicroseconds(20);
pinMode(pin_cap,INPUT);
//apply pulses
for (int ipulse = 0; ipulse < npulse; ipulse++) {
digitalWrite(pin_pulse,HIGH); //takes 3.5 microseconds
delayMicroseconds(3);
digitalWrite(pin_pulse,LOW); //takes 3.5 microseconds
delayMicroseconds(3);
}
//read the charge on the capacitor
int val = analogRead(pin_cap); //takes 13x8=104 microseconds
minval = min(val,minval);
maxval = max(val,maxval);
sum+=val;

//determine if LEDs should be on or off
long unsigned int timestamp=millis();
byte ledstat=0;
if (timestamp<prev_flash+10){
if (diff>0)ledstat=1;
if (diff<0)ledstat=2;
}
if (timestamp>prev_flash+flash_period){
if (diff>0)ledstat=1;
if (diff<0)ledstat=2;
prev_flash=timestamp;
}
if (flash_period>1000)ledstat=0;

//switch the LEDs to this setting
if (ledstat==0){
digitalWrite(pin_LED1,LOW);
digitalWrite(pin_LED2,LOW);
if(sound)noTone(pin_tone);
}
if (ledstat==1){
digitalWrite(pin_LED1,HIGH);
digitalWrite(pin_LED2,LOW);
if(sound)tone(pin_tone,2000);
}
if (ledstat==2){
digitalWrite(pin_LED1,LOW);
digitalWrite(pin_LED2,HIGH);
if(sound)tone(pin_tone,500);
}

}
//subtract minimum and maximum value to remove spikes
sum-=minval; sum-=maxval;

//process
if (sumsum==0) sumsum=sum<<6; //set sumsum to expected value
long int avgsum=(sumsum+32)>>6;
diff=sum-avgsum;
if (abs(diff)<avgsum>>10){ //adjust for small changes
sumsum=sumsum+sum-avgsum;
skip=0;
} else {
skip++;
}
if (skip>64){ // break off in case of prolonged skipping
sumsum=sum<<6;
skip=0;
}

// one permille change = 2 ticks/s
if (diff==0) flash_period=1000000;
else flash_period=avgsum/(2*abs(diff));

if (debug){
Serial.print(nmeas);
Serial.print(" ");
Serial.print(minval);
Serial.print(" ");
Serial.print(maxval);
Serial.print(" ");
Serial.print(sum);
Serial.print(" ");
Serial.print(avgsum);
Serial.print(" ");
Serial.print(diff);
Serial.print(" ");
Serial.print(flash_period);
Serial.println();
}

}

Testing


Source: Instructables

Sunday, June 24, 2018

Arduino ATTINY PROGRAMMING SHIELD

I still remember the old days of early embedded systems kits and board. Those days where you had to make your own chips programming circuits because they were hard to find and too expensive.


You also had to wire your programmer on the circuit and then connect it to the PC using Parallel or Serial Ports.

When things got advanced, those Parallel and Serial Ports became hard to find. Even ready made programmers and DIY programmers started to be pain in the neck as they only worked with legacy technology PCs and Laptops.

Then the next generation of programmers came and it supported the more advanced USB ports.
Now you can program any chip with your USB programmer.

And then came the Arduino. It started a new age of embedded systems. New kits were introduced and there became new way of programming embedded chips.

Arduino made life much easier. Now you can make a DIY programmer for virtually any Microcontroller chip you like.

Just build the circuit, connect it to Arduino and then program your chip at once.

You can even make your circuit in Arduino Shield form that can fit on top of one of Arduino boards.

Here is how you can program Attiny Microcontroller and make it a standalone Arduino on a chip. 

This Microcontroller as you know is from Atmel family and behaves exactly as Arduino.

So if you program it with Arduino firmware you can have your own small footprint Arduino.

Component

Attiny85
Protoboard
Male Header Pins
10uF Capacitor
IC socket
1K resistor and LED
Arduino UNO or Mega

Circuit


Software

The best part is that you don't need any external software as a loader. You can actually use Arduino IDE as a firmware loader after you define Attiny chip on Arduino IDE.

Picture of Programming the Attiny





Source: instructables

Saturday, June 23, 2018

Connecting Arduino UNO with ESP8266 and to ThingSpeak

Today I found a great article about how to configure ESP8266 to connect to Arduino UNO in super simple steps and then connect them all to ThingSpeak website.



This article is a real treasure to anyone who wants to get started with ESP8266 and doesn't know where to start from.

What I liked the most about this article and what makes it so special

  1.  The author also clarifies the difference between ESP32 as the newer ESP module and the ESP8266 WIFI Module with basic function.
  2. Another thing I liked about the article is a new trial the author has made and succeeded in doing it. This trial is by accessing ESP8266 WiFi Module directly but using Arduino UNO as a bridge. I've seen many other programmers and makers who used USB-to-TTL converters and made the task of configuring the module seem so hard. But this author has clarified the steps making it so simple and straightforward.
  3. Another useful thing I've learned from this article is ThingSpeak. The IoT website that you can use to connect your application and then analyze your data using Matlab tools and all for free.
Signup tsp ml image
So let's get started.

Testing the ESP8266 Directly

Connection
Esp8266 | Arduino 
-----------------
     RX | RX 
     TX | TX 
    GND | GND
    VCC | 5v 
  CH_PD | 5v 
 GPIO 0 | None 
 GPIO 2 | None
Arduino | Arduino
-----------------
  Reset | GND




 

Accessing ESP8266 from Arduino Uno code

Esp8266 | Arduino 
 — — — — — — — — -
     RX | 11 
     TX | 10 
    GND | GND (same)
    VCC | 5v (same) 
  CH_PD | 5v (same) 
 GPIO 0 | None (same) 
 GPIO 2 | None (same)



Code

#include <SoftwareSerial.h>
#define RX 10
#define TX 11
String AP = "WIFI_NAME";       // CHANGE ME
String PASS = "WIFI_PASSWORD"; // CHANGE ME
String API = "YOUR_API_KEY";   // CHANGE ME
String HOST = "api.thingspeak.com";
String PORT = "80";
String field = "field1";
int countTrueCommand;
int countTimeCommand; 
boolean found = false; 
int valSensor = 1;
SoftwareSerial esp8266(RX,TX); 
 
  
void setup() {
  Serial.begin(9600);
  esp8266.begin(115200);
  sendCommand("AT",5,"OK");
  sendCommand("AT+CWMODE=1",5,"OK");
  sendCommand("AT+CWJAP=\""+ AP +"\",\""+ PASS +"\"",20,"OK");
}
void loop() {
 valSensor = getSensorData();
 String getData = "GET /update?api_key="+ API +"&"+ field +"="+String(valSensor);
sendCommand("AT+CIPMUX=1",5,"OK");
 sendCommand("AT+CIPSTART=0,\"TCP\",\""+ HOST +"\","+ PORT,15,"OK");
 sendCommand("AT+CIPSEND=0," +String(getData.length()+4),4,">");
 esp8266.println(getData);delay(1500);countTrueCommand++;
 sendCommand("AT+CIPCLOSE=0",5,"OK");
}
int getSensorData(){
  return random(1000); // Replace with 
}
void sendCommand(String command, int maxTime, char readReplay[]) {
  Serial.print(countTrueCommand);
  Serial.print(". at command => ");
  Serial.print(command);
  Serial.print(" ");
  while(countTimeCommand < (maxTime*1))
  {
    esp8266.println(command);//at+cipsend
    if(esp8266.find(readReplay))//ok
    {
      found = true;
      break;
    }
  
    countTimeCommand++;
  }
  
  if(found == true)
  {
    Serial.println("OYI");
    countTrueCommand++;
    countTimeCommand = 0;
  }
  
  if(found == false)
  {
    Serial.println("Fail");
    countTrueCommand = 0;
    countTimeCommand = 0;
  }
  
  found = false;
 }


Source : Medium

Thursday, June 21, 2018

The ONE Thing: The Surprisingly Simple Truth Behind Extraordinary Results : Book Review


The ONE Thing

Today I’ve finished reading this interesting book. The ONE Thing.
The book provides a new concept of the importance of focusing on your most important priorities in your life.

The onething represents the first thing that you want and need to do first and dedicate the first and most precious time for.

The ONE Thing: The Surprisingly Simple Truth Behind Extraordinary Results by [Keller, Gary, Papasan, Jay]

The onething is the thing that you need to block large chunks of time for it. It’s the thing that if you identify correct then all other things will be easier or not important compared to it.


Sunday, June 17, 2018

Bluino Loader - How to program Arduino via Bluetooth

In this post I've found an interesting project to use with Arduino. This is a project where you can upload Arduino Sketches to your Arduino board via Bluetooth connection only.


This means that you only need to connect Arduino board to your PC or Laptop only once for first time programming and configuration and then use your Android Phone to write code, compile and then upload sketches to your Arduino directly via Bluetooth.

Cover art

Success Story

The maker  sure has a very successful story of making and designing. The concept is all built around the powerful Android application that does it all.
The maker is so smart as he took the hardware open source approach with his concept. He has even designed his own Arduino Shield that made the same function and compatible with his application.
The maker offers the application for free on Google Play Store with the availability to buy the Pro version of the app.

Materials

Picture of Materials and Tools

Hardware :
Software :
  • Bluino Loader from the Google Play store

Steps

Program using PC or Laptop

void setup() {
  Serial.begin(38400);
  delay(500);   
  Serial.println("AT+NAME=Bluino#00");
  delay(500);
  Serial.println("AT+UART=115200,0,0"); // Use this baudrate if using for Arduino Uno, Bluino and Mega2560
//Serial.println("AT+UART=57600,0,0");  // Use this baudrate if using for Arduino Nano, Leonardo, Micro, Pro Mini 3V3/5V and Duemilanove
  delay(500);
  Serial.println("AT+POLAR=1,0")
  delay(500);
}

void loop() {
}

This step comes first to configure Arduino and Bluetooth module for the process.
You need to upload the code to Arduino.
This code contains several functions to change the parameters of Bluetooth HC-05 :
  • AT+NAME=Bluino#00 : Change name of bluetooth module, default name is "HC-05".
  • AT+BAUD=115200,0,0 : Change baud rate to 115200 (Arduino Uno, Bluino and Mega2560)
  • AT+BAUD=57600,0,0 : Change baud rate to 57600 (Arduino Nano, Leonardo, Micro, Pro Mini 3V3/5V and Duemilanove)
  • AT+POLAR=1,0 : Change state pin conditio
  • For additional you can change password to use not standard password while pairing, AT+PSWD=xxxx.
Note

Name of bluetooth must "Bluino#00-9999", if you want custom name you should use the paid version of Bluino Loader App.

Connection

Picture of Hook Up Like Schematic

Note the capacitor and resistor connected between Arduino and Bluetooth. Those components are important for resetting Arduino after sketch upload finishes.
Picture of Hook Up Like Schematic

Setup Bluetooth HC-05

This is the step where you will run the code you uploaded to Arduino while the Bluetooth module is connected to Arduino.
Picture of Time to Setup Bluetooth HC-05
Note this carefully. You need to force the Bluetooth module into AT command mode using these steps.
Press and hold KEY button
• Plug USB cable for powering Arduino
• Wait about 5 second (still hold KEY button)
• Unplug and re plug USB for reset from AT command mode


Install and run the application

The application looks like Arduino IDE

Picture of Try Upload Sample Sketch Blink.ino Into Arduino Using Android Device Over Bluetooth

Here you can write, compile and then upload sketches to your Arduino project without having troubles connecting it to PC or Laptop.

Of course the first program that comes in mind when trying this method is the Blink example.

  • After installing the app you can open example sketch BluinoLoader/examples/02.Basic/Blink/Blink.ino
  • Tap on "upload" button (Arrow in the circle icon)
  • After done compiling no error, tap button "Scan Bluino Hardware" to search active bluetooth
  • Pick bluetooth hardware with name "Bluino#00"
  • Enter pairing code standard "1234", then OK
  • Wait until process uploading done
After all steps your Arduino will blink on led 13, and you can repeat all the steps to upload another sketch.
Congratulations ..  You have made your Bluetooth Programmable Ready Arduino project.
Now you can write any code and then compile it and then upload it all using your smart Android.
Thanks  mansurkamsur. Keep going.

Source: instructables

Saturday, June 16, 2018

Arduino Tug - Arduino Aircraft Towing Machine

Towing an aircraft has been there for a long time without any change. Only when you see larger aircraft you can notice how those towing and push-back machines (Tugs) are getting bigger.

Tugs are those machines powered by traditional fossil fuel to move aircrafts on the ground to save highly priced Jet Fuel on the ground in an operation known as Aircraft Taxiing.



Now electric tugs are beginning to be popular and gain more attention from airliners.
To save conventional fuel and to save the planet from harmful fossil fuel emissions, transforming to electric power is the better solution in all transformation means.

There are some different versions and inventions implementing the idea of electric towing and push-back. Here are tow of them.

  • WheelTug

WheelTug is an electrical system which enables an aircraft to push-back and taxi without using its own engines or an external tug. WheelTug reduces the time an airplane spends on the ground, allowing it to spend more time in the air. It saves time, money and fuel consumption.



  • Mototok

Mototok provides a family of innovative solutions for aircraft towing and hangar management.
The company provides state of the art series of innovative electric tugs that can be used with aircrafts of up to 195 tons of weight.
Mototok products can be remotely controlled by a single person operation.

It's available for a wide range of Military, Commercial Airliners and Helicopter aircrafts with different models.





Arduino Controlled Aircraft Tug



Anthony DiPilato wanted to make his own aircraft tug that can be controlled from his iPhone. So he decided to use Arduino Mega and an  HC-08 Bluetooth module to build it.

Wrote the software for Arduino and an iPhone interface to control it.

This little device looks like a little tank and can move light aircrafts.

But it's capable of pulling a Cessna 310 with an estimated weight of 5,200 lbs.


Design and Bill of Material




Device Testing





Tug in Action






Sources:
Author website

Arduino Website