Mturk Jobs

Mturk Jobs
Mturk Jobs

Tank

Thursday, October 25, 2018

Arduino Cricket - How to generate soothing realistic Cricket Sounds with Arduino

The cricket is a little bug that makes noisy sounds at night.




Some people find them annoying. But some others - and I’m one of them - find them soothing and a symbol of nature and piece.

I admit that this repeatable sound of cricket can be annoying. It might get you sleep deprivation specially if it keeps making this noise in a place near where you sleep.

But the other type of people who find its sound soothing may be grateful to hear it at bedtime and feel relaxed from it.


There are even some iPhone and Android apps that do nothing but playing those sounds to keep you relaxed.

Today I thought of generating these sound using Arduino for fun.

This can be a good way of relaxation and you don’t need to go look for that cricket if you want it to stop. In this case you can simply turn it off. 

After all you are who programmed it.

I found a good post from a cleaver guy who made the most annoying cricket sound ever.

He wanted to make it a prank for his friend that he made the sound generation at random intervals.

He also made a consistent version of sound that sounded just like the normal cricket does.

In this version you can control the volume using PWM Pulse Width Modulation.

I liked the consistent sound version.


So here is how I made it.






What you’ll need:


  • Arduino board.
  • 8 ohm speaker.
  • Wires to connect the speaker to Arduino board.

Program the software

Circuit




Connect the speaker




Play the sound of your cricket.

That’s all.

Thank you for reading.


Code

#include "Volume3.h"
#define speakerPin 9

void setup() {
  // put your setup code here, to run once:

}

void loop() {
  // put your main code here, to run repeatedly:
  chirpFade();
  delay(random(100,5000));
}

void chirpFade() {
  uint16_t f = 3900;

  uint8_t times = random(1,3);
  float master = 1.0;
  uint16_t v = 0;
  uint8_t vDir = 1;
  float vb = 0;

  while (times > 0) {
    while (vb < 1.0) {
      if (v < 1023 && vDir == 1) {
        v += 16;
      }
      else {
        vDir = 0;
      }

      if (v > 0 && vDir == 0) {
        v -= 16;
      }
      else {
        vDir = 1;
      }

      vol.tone(speakerPin, f, v * constrain(vb, 0.0, 1.0)*master);
      delayMicroseconds(50);
      vb += 0.003;
    }
    while (vb > 0.0) {
      if (v < 1023 && vDir == 1) {
        v += 16;
      }
      else {
        vDir = 0;
      }

      if (v > 0 && vDir == 0) {
        v -= 16;
      }
      else {
        vDir = 1;
      }

      vol.tone(speakerPin, f, v * constrain(vb, 0.0, 1.0)*master);
      delayMicroseconds(50);
      vb -= 0.001;
    }
    times--;
    master -= 0.75;
  }
  vol.noTone();

}


Source

https://github.com/connornishijima/arduino-volume1/tree/master/examples/volume_crickeduino_prank

Tuesday, October 23, 2018

Arduino Ladder Logic - How to program Arduino like PLC using Ladder Logic

I've posted an article about Arduino based PLC and I've an unexpected response.

Many Arduino enthusiasts and students and also many other automation specialists showed interest to the subject.

This simply shows how there are so many people wanting to know more about open source and freely developed tools that can be used in automation and in industry as a whole.

I remember a friend of mine who had a dream since fourteen years ago. That dream he had was to replace old PLCs with modern Microcontrollers like PIC, Atmel and lately Arduino.

I guess now his dream came true.

I received a lot of questions on Arduino based PLC products and how they can be programmed.

So I’ve searched further and found that there are already some tools that can be used to program Arduino using ladder language.

PLCs are often programmed in ladder logic. This is because PLCs originally replaced relay control systems, and after all those years, we still haven't quite let go. A PLC, like any microprocessor, executes a list of instructions in sequence.


Today I’m putting these tools in front of you so you can start learning them and hopefully using them efficiently.


SoapBoxSnap


SoapBox Snap is a free and open source PC-based automation platform.

The ladder editor includes standard instructions like contacts, coils, timers, counters, rising edge and falling edge, and set/reset instructions.

SoapBox Snap also comes with an Arduino Runtime, which means you can download your ladder logic programs to an Arduino (UNO, Nano or Mega board) and even do online debugging and forcing.





LDmicro

It’s a compiler that starts with a ladder diagram and generates native PIC16 or AVR code.
Features include:

-       digital inputs and outputs
-       timers (TON, TOF, RTO)
-       counters (CTU, CTD, `circular counters' for use like a sequencer)
-       analog inputs, analog (PWM) outputs integer variables and arithmetic instructions
-       easy-to-use serial communications, to a PC, LCD, or other device
-       shift registers, look-up tables
-       EEPROM variables, whose values are not forgotten when you lose power
-       simulator, to test your program before you generate PIC/AVR code
http://cq.cx/ladder.pl

I hope this article could shed some light on the subject.

Thank you for reading.




Check My books on Amazon:





Learn By Making: Embedded Systems Tutorial for Students and Beginners




Embedded Systems, Electronics: My Projects Collection From Instructables





Monday, October 22, 2018

Arduino based PLC - Where Arduino Meets Industrial Applications

Some people still think about Arduino and open source electronics as a toy for hobbyists and students.

We believe that open source hardware is in the process of revolutionizing electronics and industry in all fields of our lives.

Arduino and its shields have matured to be a modern way of researching tool, rapid prototyping and even in the field equipment for many industries.


M-DUINO PLC Arduino 57AAR I/Os Analog / Digital / Relay PLUS


Ease of use has made Arduino a good candidate for many applications. The variety of tools and millions of lines of code have facilitated the process of development.

Abundant sensors and massive processing power have found their way in Internet of Things era.

Collaborating with Big Data to collect huge amounts of bits of data to form useful information that lead to giant knowledge base for decision making on larger scales; Arduino is the heart for this big picture.


Odoo image and text block

Source: industrialshields.com

Today you can find weather monitoring stations completely built around open source hardware using open source tools for competitive prices.







Many companies are forming around Arduino platform to evolve into industrial automation makers.

To name some:

industrialshields.com is making its own industrial Arduino PLC and shields to control water level in tanks, production lines and weather station monitoring systems.

sferalabs.cc is making industrial enclosures for Arduino kits and shields for robustness.

If you are interested in Arduino, you can start by learning how to build your own industrial application.



Monday, October 15, 2018

Arduino Drawing Robot - How to do Art with Arduino and a Pen

In this post will see how this Arduino controlled robot can make beautiful patterns and drawings.




Gathering Parts




Arduino Uno
2 5v Stepper Motors
Micro Servo
ULN2803
Breadboard


Code
You can get the code from here.





Making the frame





Circuit diagram

Installing Wheels





Mounting Servo for Pen movement





Final Assembly and Test




Source
https://www.instructables.com/id/Arduino-Drawing-Robot/




Check our books on Amazon:





Learn By Making: Embedded Systems Tutorial for Students and Beginners








Embedded Systems, Electronics: My Projects Collection From Instructables




Sunday, October 14, 2018

Modify your old RC Car into that new modern smartphone controlled car with Arduino and Bluetooth

Who have every played with his toy RC car?
Today you can turn your old RC car into an advanced Android RC car using Arduino and Bluetooth shield in simple straight forward steps.




First you need to get the car that fits all of those simple components required for the new control circuit.


Then you need to get all of the stuff out of it. You can find room for your control board as those modern circuits are much smaller than regular ones.



What you’ll need

Arduino UNO
HC-06 Bluetooth shield
L293D IC
12v Lipo battery pack
Some resistors



And you need the program that controls the circuit




Android program:

https://play.google.com/store/apps/details?id=braulio.calle.bluetoothRCcontroller





Source:
https://www.instructables.com/id/Arduino-Bluetooth-RC-Car-Android-Controlled/




Check our books on Amazon:





Learn By Making: Embedded Systems Tutorial for Students and Beginners









Embedded Systems, Electronics: My Projects Collection From Instructables





Saturday, October 13, 2018

Beginner's Dream Quadcopter - Arduino and Bluetooth Micro Quadcopter



This is sure the Beginner's Dream Quadcopter. I've searched a lot for a Quadcopter like this. Today I've found it.





I didn't ask too much. But I couldn't find it until today. And that's why I wanted to share it with you.

Why would it make the Beginner's Dream Quadcopter?

Simplicity
This is one of the simplest quadcopter circuit I've seen recently.  It uses Arduino Nano as its main controller. As for quadcopter stabilization it uses 6050 MPU Module.
User control interfacing circuit is achieved via HC-06 Bluetooth module. This means that you can control this little quadcopter from your smartphone.

Motor drive circuits is built using four transistors.






Source: instructables




Check our books on Amazon:





Learn By Making: Embedded Systems Tutorial for Students and Beginners









Embedded Systems, Electronics: My Projects Collection From Instructables





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//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 (timestampif (diff>0)ledstat=1;
if (diff<0 ledstat="2;<br">}
if (timestamp>prev_flash+flash_period){
if (diff>0)ledstat=1;
if (diff<0 ledstat="2;<br">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 br="" expected="" set="" sumsum="" to="" value="">long int avgsum=(sumsum+32)>>6;
diff=sum-avgsum;
if (abs(diff)>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 br="">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




Check our books on Amazon:





Learn By Making: Embedded Systems Tutorial for Students and Beginners









Embedded Systems, Electronics: My Projects Collection From 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





Check our books on Amazon:





Learn By Making: Embedded Systems Tutorial for Students and Beginners









Embedded Systems, Electronics: My Projects Collection From Instructables







Tank