Download libraries
- Steps:
Electronic circuit designing involves the selections and interconnections of physical devices, for
different purposes. It is important to define the requirements that you are going to use such as: resistors,
capacitors, buttons, leds, voltage regulator and one of the most important things the microcontroler (brain).
For this week assignment I will be creating my own pcb using Kicad and an ESP32-wroom32.
If you want to read the Group Page, Click Here.
For this group assignement we had to test different equipment to know more about electronics and a microcontroler operation.
There are different microcontrolers boards depending on the project your making. The most common ones are:
Arduino, RaspberryPi, ESP32, PIC, etc.
A power supply it is used to power up the circuits you build, depending on you requierements AC or DC.
It is used for meassuring voltage, current, resistance, capacitance, continuity, etc. Basically is a test tool
to meassure different values. You can change it mode by switching the dial to its position and verify the input jacks.
Voltage
If you want to meassure Voltage verify the dial is in V (DC or AC) and connect it in parallel in the part you want.
Current
For current change the dial to A and the input jack. For meassuring you have to open the circuit and make a series conection.
Resistance/Capacitance
In the case of resistance and capacitance when you dont know the value you only have to touch it with the 2 probes.
It is used to visualize/analyze the behavior of the electronic signals. Commonly used for fixing mistakes, debugging and check the signal integrity.
It produces different type of waveforms (sine, square, triangle), used to test different signals conditions.
One of the most important parts of the components is the datasheet, in here you can find the lenght of the components, voltage, current,
schematics and everything you need for designing your circuits.
const int analogInPin = A0;
int k=49; // Number of samples
int sensorValue[50]; // Vector to storage data
int i;
unsigned long ts = 2.5; // Sample time mseg
unsigned long TiempoAhora = 0;
//sensorValue = 0; // value read
void setup() {
// initialize serial communications at 9600 bps:
Serial.begin(9600);
}
void loop() {
for(i=1;i < =k;i++){
TiempoAhora = millis();
sensorValue[i] = analogRead(analogInPin);
// wait n milliseconds before the next loop for the analog-to-digital
// converter to settle after the last reading:
while(millis() < TiempoAhora+ts){
// espere ts milisegundos
}
}
// print the results to the Serial Monitor:
for(i=1;i < =k;i++){
Serial.println(sensorValue[i]);
delay(5);
}
Serial.end();
}
function Matlab_Arduino(~)
% Matlab + Arduino Serial Port communication
close all;
clc;
frecuencia = 50;
periodo=1.0/frecuencia;
numero_muestras=40;
% Se tomaran 20 muestras por ciclo de la señal se graficaran 2 ciclos
% Total de muestras 40
% Con un tiempo de muestreo del Arduino cada
delay_arduino=2*periodo/numero_muestras;
y=zeros(1,numero_muestras); %Vector donde se guardarán los datos
x=(0 : 1: numero_muestras-1)*delay_arduino;
t=delay_arduino*(0:1:numero_muestras-1);
disp('fijar delay de arduino');
disp(delay_arduino*1000);
z=input('listo ???');
%Inicializo el puerto serial que se utilizará
delete(instrfind({'Port'},{'COM5'}));
puerto_serial=serial('COM5');
puerto_serial.BaudRate=9600;
warning('off','MATLAB:serial:fscanf:unsuccessfulRead');
%Abro el puerto serial
fopen(puerto_serial);
%Declaro un contador del número de muestras ya tomadas
contador_muestras=1;
ylim([0 5.1]);
xlim([0 numero_muestras]);
%Bucle while para que tome y dibuje las muestras que queremos
while contador_muestras < =numero_muestras
valor_potenciometro=fscanf(puerto_serial,'%d')';
y(contador_muestras)=(valor_potenciometro(1))*5/1024;
contador_muestras=contador_muestras+1;
end
%plot(x,y);
plot(x,y,'-o');
grid on;
figure;
sig=2.5*sin(2*pi*frecuencia*t)+2.5;
%plot(t,sig);
plot(t,sig,'-o');
grid on;
%Cierro la conexión con el puerto serial y elimino las variables
fclose(puerto_serial);
delete(puerto_serial);
clear all;
end
There are different softwres for designing circuits such as:
First we can se the work frame where we can add the components and its conections.
On the right bar are all the components, wire, labels, text, all you need for your Schematic.
And some more options on the top bar as: creating a PCB, zoom, mirror, rotation, etc.
In all the left side bar we can add items by clicking them or using its shortcut.
By clicking A or the button it will appear the window where you can find all the components schematics,
footprint, component name and datasheet.
*Note: It is importantto verify the footprint of your component.*
Components I use
On the navigation bar -> Inspect -> Electical Rules Checker -> Run ERC
Here you can find all you mistakes on your conections, design, power supplies, etc.
In this case instead of uploading a png file, right on top we upload the SVG format.
We modify the same parameters of milling and cutting, in my case I will lower the speed to 3 mm/s, 2 offset and
a tool diameter of 0.3 mm. I change this because some of my components have smaller paths.
Having this 2 different files for milling and cutting.
For creating a case to the new PCB made I used Solidworks for the design, Cura for getting the g-code and print it in an
Ender.
For soldering the firt thing to do was getting all the components.
I added a button (GPIO4) and a Neopixel (GPIO2) for testing that the board works I will be changing its color by pressing the button.
Steps:
#include
#define PIXEL_PIN 2
#define NUM_PIXELS 1
#define BUTTON_PIN 4
Adafruit_NeoPixel pixels(NUM_PIXELS, PIXEL_PIN, NEO_GRB + NEO_KHZ800);
// Define colors
uint32_t colors[] = {pixels.Color(255, 0, 0), // Red
pixels.Color(0, 255, 0), // Green
pixels.Color(0, 0, 255)}; // Blue
int current_color_index = 0;
void setup() {
pixels.begin();
pinMode(BUTTON_PIN, INPUT_PULLUP);
}
void loop() {
if (digitalRead(BUTTON_PIN) == LOW) { // Button is pressed
changeColor();
while (digitalRead(BUTTON_PIN) == LOW) { // Wait for button release
delay(10);
}
}
}
void changeColor() {
current_color_index = (current_color_index + 1) %
(sizeof(colors) / sizeof(colors[0]));
pixels.fill(colors[current_color_index]);
pixels.show();
}