In this video we will see how to make an inductive sensor for Arduino. We’ll start by looking at the electronic components we’re going to use, then step together the circuit, also explain the source code in detail, and finally test how the whole system works.
You may be interested in projects in Arduino, pic, robotics, telecommunications, subscribe http://www.youtube.com/user/carlosvolt?sub_confirmation=1 videos with full source code and diagrams
Materials
Two 2.2 uF electrolytic capacitors
A 10 uF capacitor
A 47K resistor
An integrated circuit 555
A printed circuit
Download gerber file —> Gerber_detector_metales
A 6800 uH inductor
Male pins
An 8-pin socket
Source
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
#include <FreqCount.h>//Debemos incluir esta librería para el conteo de la frecuencia //Variables int led2=2; int led3=3; int led4=4; unsigned long count = 0; void setup() { Serial.begin(9600);//Velocidad del puerto serial FreqCount.begin(1000); //pin 2, 3 y 4 se configuran como salidas pinMode(led2, OUTPUT); pinMode(led3, OUTPUT); pinMode(led4, OUTPUT); } void loop() { if (FreqCount.available()) {//Devuelve verdadero cuando hay una nueva medida disponible count = FreqCount.read();//Devuelve la medición más reciente, la medición se hace por defecto en el pin numero 5 del arduino Serial.println(count);//Imprime el valor de la frecuencia obtenida en el monitor serial //Comparamos si el valor de la frecuencia es menor a 2800 encendemos el led if(count<2800){ digitalWrite(led2, HIGH); }else{ digitalWrite(led2, LOW); } //Comparamos si el valor de la frecuencia es menor a 2700 encendemos el led if(count<2700){ digitalWrite(led3, HIGH); }else{ digitalWrite(led3, LOW); } //Comparamos si el valor de la frecuencia es menor a 2600 encendemos el led if(count<2600){ digitalWrite(led4, HIGH); }else{ digitalWrite(led4, LOW); } } } |
Diagram
Inductive sensor mounted on a protoboard, with an arduino mini pro and source for powered protoboard, the whole circuit with 5 volts.
You can also see that it is connected a serial USB cable, which allows us to see in the Arduino ide which frequency you are reading.
SUBSCRIBE TO OUR NEWSLETTERS, RECEIVE IN YOUR EMAIL THE MOST OUTSTANDING NEWS, JUST BY ENTERING YOUR EMAIL
[wysija_form id=”1″]
RECOMMENDED PROJECT