Eighth week and the classes continue to surprise me, every week there is something really new and above all complex for me, this time we continue with the part that for me is the most difficult of all, electronics, here I will show you a little of everything I did.
This week I have worked in greater depth the theoretical part because unfortunately the machine has had problems to perform new work, however I have generated a research on my components and circuits that I have been designing.
In this new stage of the fab academy we have as a group task to demonstrate and compare toolchains and development workflows for alternative embedded architectures. Stefany Casanova and I started researching about this and we managed to understand the potentialities of the different microcontrollers we chose.
The research conducted is shown below:
Stefany Casanova and I decided to use the ATtiny 1614 microcontroller for our final boards, however at first we were doing our first tests with the Attiny 85, so here we will share the research we did with both.
But first, what is a microcontroller? A microcontroller is an integrated circuit that contains a central processing unit (CPU), memory units (RAM and ROM), input and output ports and peripherals. These parts are interconnected inside the microcontroller, and together they form what is known as a microcomputer. A microcontroller is a complete microcomputer encapsulated in an integrated circuit.
After previous research and getting my board operational during board design week, I finally got up the nerve to use some sensors to test its operation, below I share my tests.
To test the operation of my board and to practice with some new sensors, I was encouraged to test two types of flows, it is important to mention that each test process took me considerable time because I had to research about the programming of each sensor.
As part of the contribution to my final project, it is possible that I will use some of these flows to make it possible.
The PIR sensor will allow me to detect the user's movement but I also investigated that the infrared sensor could have the same functionality, and maybe even more accurate than the first one. We'll see how it goes!
//Mayra Ascencio Calderón
/*
Blink*/
// the setup function runs once when you press reset or power the board
const int RadarPin = 0; // digital input pin to hook the sensor to
const int ledPin = 8; // LED instalado en la placa
const int motorDC = 1; // Se define la salida del motor, en el caso de usar el octoacoplado cambiar por 2
int value = 6; // variable to store the value coming from the sensor
void setup() {
// initialize digital pin LED_BUILTIN as an output.
pinMode(ledPin, OUTPUT); // salida digital led de placa
pinMode(motorDC, OUTPUT); // salida digital PWM, motor
pinMode(RadarPin, INPUT); // entrada digital, sensor PIR
}
// the loop function runs over and over again forever
void loop() {
value = digitalRead(RadarPin);
// check if the pushbutton is pressed. If it is, the buttonState is HIGH:
if (value == HIGH) {
// turn LED on:
digitalWrite(ledPin, HIGH);
digitalWrite(motorDC, HIGH);
} else {
// turn LED off:
digitalWrite(ledPin, LOW);
digitalWrite(motorDC, LOW);
}
}
#include
const int sensor = 0;
const int boton = 10;
const int led1 = 8;
int s1,s2;
Servo servo1;
const int pinservo1=1;
void setup() {
pinMode(boton,INPUT);
pinMode(sensor,INPUT);
pinMode(led1,OUTPUT);
servo1.attach(pinservo1);
}
void loop() {
s2=digitalRead(boton);
s1= digitalRead(sensor);
if (s1==1)
{
servo1.write(0);
}
else
{
servo1.write(90);
}
if (s2==1)
{digitalWrite(led1,HIGH);
}
else
{
digitalWrite(led1,LOW);
}
delay(200);
}