Thursday, April 26, 2018

Arduino Uno Unleashed - How to get started with Arduino Uno

Arduino Unleashed.

This is a new series I decided to introduce as part of my tutorials.

In each post we'll deal with one Arduino/Arduino Compatible board with simple steps that can get you started even if you are a complete beginner.




Warning:
This instructable is NOT for experts.

If you want to learn Arduino then you need to get your hands busy. So Let's get started.






Programming

What you need:



USB Cable

Arduino IDE (download and setup on your computer)




I know this is so primitive but if you are a beginner this is really rewarding.

If you manage to blink an LED in one system then you can do anything else.

Open Arduino IDE. From the menu choose ….

Tools -- Board -- Arduino Uno


Then

File – Examples – Basics – Blink.






Then you can see the code that blinks the built in LED in your Arduino board.




Choose menu

File – Upload




Now you can see the LED in Arduino board blinking at a constant rate.




Congratulations.

You have completed the very first Arduino lesson.

Stay tuned to many other lessons.








Wednesday, April 25, 2018

Arduino Capacitive Touch Sensor - How to control the world with your fingertips and an Arduino board only

We still looking in easy and affordable ways to communicate with Arduino through our bio-metric signals without having to use very expensive gadgets.

During the previous days we figured out some projects that try to read human signals (such as Galvanic Skin Response).

Today we are going to study a new project that uses human body capacitance to control Arduino projects.


In this project you’ll learn how you can control stuff connected to Arduino only by touch of your fingertips.

This is called capacitive touch sensing. You don’t need special tools or hardware. Instead, you use Arduino as a measurement tool to sense your body’s capacitance to inform Arduino board of that touch.

In this form, you can using touch as any normal control you know. This can replace a toggle stich, a push button or a slider.

You can use your imagination to control different stuff from your environment.

From my own personal experience, I’ve been noticing strange activity when interacting with microcontroller like Microchip PIC with touch. I noticed that the circuit responds to that touch. I knew then that response was a response to capacitance.

I actually thought of using touch as a means to control microcontroller. I’ve tried to make it by reading input from the microcontroller pin many times.

Although I’ve been somehow close to the right way of doing so, but I didn’t accurately read the state of touch to differentiate it from the non-touching state.

Later I found a project that implemented the idea using Microchip PIC. And today we have many projects using the Arduino capacitive touch library to make creative stuff. My dream has become true. I’m really happy about it. Even I didn’t do it myself, but my idea was correct.

And due to the fact that this circuit doesn’t require any hardware (only the Arduino board and some wires) it makes it a perfect Arduino project for me.

As you all know, I love projects that’s made of Arduino and Arduino only.









In Arduino website you can find the capacitive touch sensor library. You need to add it to your Arduino IDE and then use it in your sketches.







Source:  Arduino Website , instructables








Tuesday, April 24, 2018

Arduino lie detector - How to make a simple and easy lie detector with Arduino

Yesterday we studied how to detect Galvanic Skin Response GSR with Arduino.

Today we are going to see how we can use this knowledge to build a simple Arduino based Lie detector.

I found two projects that made sense about the subject.

Actually I have a certain criteria for choosing what projects to post.

First:

There must be scientific and practical credibility for the project.

I mean that it must be real, well written and well researched.

Second:

It must be easy to build and to realize.

Easy doesn't mean with no effort. But easy means that it can be built by following the steps as stated in the project.

That's what I found in those two projects here.


First Project

This project makes the GSR analysis with Arduino and then gives the result on one of two LEDs. Green or RED.

Circuit




Code

void setup()
{
 Serial.begin(9600);
 pinMode(2, OUTPUT);
 pinMode(3, OUTPUT);
 pinMode(4, OUTPUT);
 digitalWrite(2, HIGH);
 delay(500);
 digitalWrite(3, HIGH);
 delay(500);
 digitalWrite(4, HIGH);
 delay(500);
}

void loop()
{
 if (analogRead(A0) > 60)
 {
  digitalWrite(4, HIGH);
 }
 else
 {
  digitalWrite(4, LOW);
 }
 if (analogRead(A0) > 20)
 {
  digitalWrite(2, HIGH);
 }
 else
 {
  digitalWrite(2, LOW);
 }
 if (analogRead(A0) > 45)
 {
  digitalWrite(3, HIGH);
 }
 else
 {
  digitalWrite(3, LOW);
 }

 Serial.println(analogRead(A0));
 delay(20);
}










Second Project

This project uses temperature sensor to measure skin temperature as one of important parameters of biofeedback.

The project displays the result on an LCD and can also display results of GSR analysis on Processing code just as in yesterday project.

Circuit

Picture of Mount the LCD Screen

Picture of List of Materials


Code

You can find all software for Arduino and Processing here.



Sources: Arduino Website , instructables





















How to make Galvanic Response Sensor with Arduino?

Today I found a Mind controlled quadcopter that is fully controlled by the power of thoughts with the NeuroSky headset and Arduino MKR1000 Board.

The project is very cool and thrilling.
It's definitely for quadcopter or Arduino haters. It actually needs a lot of work, patience and understanding.

Above all, it needs that you have the NeuroSky MindWave Headset(~$75) and MKR1000 Board(~$60) from Microsoft.

I've been searching all night about a way to make a simple and easy way to read mind signals (EKG Sensor) but without any result.

All circuits and sensors are complicated and very expensive.

Then I just stumpled upon the GSR (Galvanic Skin Response) which is typically the skin resistance variation in different times due to stress or fear.


I found that this sensor is faily simple and easy to make.

It is actually made of two simple electrodes to measure the skin resistance without the need for any amplifiers or filters as in any other biometric signal measurement.

With one lead sends current while the other measures the difference.

Arduino is used to measure the resistance at a 50 milliseconds intervals.

The results are sent to processing code to be displayed.

That's what I call an easy project.

So I've decided to include it here on my blog.



Code


Arduino Code:
void setup(){
  Serial.begin(9600); 
}

void loop(){
  int a=analogRead(0);
  if (Serial.available() > 0) {

    byte inbyte=Serial.read();
    if(inbyte=='a'){
      Serial.print(a,BYTE);


    }
  }
}
Processing Code:
import processing.serial.*;
Serial myPort;  

int hPosition = 1;     // the horizontal position on the graph
float currentReading;
float lastReading;
int count=0;
int zeroLinePos=0;

float gsrAverage,prevGsrAverage;
float baseLine=0;
long lastFlatLine=0;
color graphColor=color(255,255,255);
int baselineTimer=10000;
int gsrValue;
int gsrZeroCount=0;
float gsrRange=0;
int downhillCount=0;
int uphillCount=0;
boolean downhill;
boolean peaked=false;
float peak, valley;

void setup () {
  size(900, 450);
  // List all the available serial ports
  //println(Serial.list());

  myPort = new Serial(this, Serial.list()[0], 9600);
  currentReading=0;
  lastReading=0;
  gsrAverage=0;
  background(0);

  smooth();
}

void draw () {
  //best delay setting for gsr readings
  delay(50);
  //image(myMovie, 0, 0);

  if (gsrValue<15 amp="" gsrvalue="">-15){
    if( gsrZeroCount>10){
      currentReading=0;//flatline
      gsrAverage=0;
      baseLine=0;
      lastFlatLine=millis();
      gsrZeroCount=0;
      // println("reset");

    }
    gsrZeroCount++;
  }
  else{
    currentReading=gsrValue-baseLine;
    gsrZeroCount=0;
  }

  if(millis()-lastFlatLine>baselineTimer){
    baseLine=gsrAverage;
  }

  //graph colors
  if(gsrAverage>0 && gsrAverageheight/2.0*.25 && gsrAverageheight/2.0*.5 && gsrAverageheight/2.0*.75) graphColor=color(255,100,0);

  gsrRange=peak-valley;

  // at the edge of the screen, go back to the beginning:
  if (hPosition >= width) {
    hPosition = 0;

    //cover last drawing
    fill(0,200);
    noStroke();
    rect(0,0,width,height);
  }
  else {
    hPosition+=1;
  }

  gsrAverage=smooth(currentReading,.97,gsrAverage);

  //draw stuff

  //spike
  noStroke();
  if(gsrRange>200){
    fill(255);
    ellipse(10,10,20,20); 
  }
  else{
    fill(0);
    ellipse(10,10,20,20); 
  }

  //graph
  strokeWeight(.5);
  stroke(graphColor);
  line(hPosition-1, height/2.0-lastReading, hPosition, height/2.0-currentReading);
  stroke(255,0,100);
  line(hPosition-1,height/2.0-prevGsrAverage,hPosition,height/2.0-gsrAverage);

  //draw peaks
  int thres=7;

  noFill();
  stroke(255,0,0);
  strokeWeight(2);

  if (currentReading-thres>lastReading&& peaked==true){
    downhill=false;
    //println(downhillCount);
    uphillCount++;  
    downhillCount=0;
    point(hPosition-1, height/2.0-lastReading);
    valley=lastReading;
    peaked=false;

  }
  if(currentReading+thres 1){      // check to make sure param's are within range
    filterVal = .99;
  }
  else if (filterVal <= 0){
    filterVal = 0;
  }
  smoothedVal = (data * (1 - filterVal)) + (smoothedVal  *  filterVal);
  return (int)smoothedVal;
} 

Sunday, April 22, 2018

How to connect ESP8266-01 to a Temperature Sensor

In this post we are going to study how to read temperature using simple ESP-01 Wifi Module.


This module reads temperature form the 1 wire programmable sensor DS18B20 


This is the sensor circuit



This is the programming circuit

Components
ESP8266-01
DS18B20 Temperature Sensor
FTD232





Code
https://github.com/abflower/homeass-temp_sens



Source : Hackster.io


























Saturday, April 21, 2018

Arduino KiTT From KnightRider - AKA Larson Scanner

In this quick example, we'll see how to make a beautiful Larson Scanner as in the TV show Knight Rider.


Circuit 
You can make it any number of LEDs you like. Here is the code that moves 6 LEDs in sequence.

This project is called LED chaser or Larson Scanner
Picture of Connections+

Picture of Connections+

Code



/* Knight Rider 3
 * --------------
 *
 * This example concentrates on making the visuals fluid.
 *
 *
 * (cleft) 2005 K3, Malmo University
 * @author: David Cuartielles
 * @hardware: David Cuartielles, Aaron Hallborg
 */

int pinArray[] = {2, 3, 4, 5, 6, 7};
int count = 0;
int timer = 30;

void setup(){
  for (count=0;count<6 1="" count="5;count" delay="" digitalwrite="" for="" high="" loop="" low="" output="" pinarray="" pinmode="" timer="" void="">0;count--) {
   digitalWrite(pinArray[count], HIGH);
   delay(timer);
   digitalWrite(pinArray[count - 1], HIGH);
   delay(timer);
   digitalWrite(pinArray[count], LOW);
   delay(timer*2);
  }
}
This is the Larson scanner effect that was presented in the famous knight rider series in the 80's.

It featured a smart autonomous car that had a talking on-board computer.



I'd like to mention that this project was one of my first things to make when I started to learn embedded systems using PIC16F84A microcontroller.




Here is my actual circuit





This is Proteus simulation of the circuit


I made this project and posted it in Arabic and English languages. I didn't post a video for it but I still have the circuit.


http://arabic-embedded-egypt.blogspot.com.eg/2010/05/led-chaser.html




http://embedded-egypt.blogspot.com.eg/2009/06/led-chaser-larson-scanner.html


So I'll post a video soon.


Source: Arduino Website , instructables