Programming Input & Output

In this week, I continue working in programming with focusing more in input and output. We also work in our final project, the programming side.

week05
Download free bootstrap 4 landing page, free boootstrap 4 templates, Download free bootstrap 4.1 landing page, free boootstrap 4.1.1 templates, meyawo Landing page
Task 1 - Coded output

For output devices, I start working with a fan motor to turn it on and off. Fan motor is PWM motor so refer to below guideline, I connect it with pin 18.
setting

PWM (Pulse Width Modulation) is a technique used to control the amount of power delivered to an electrical device by varying the duty cycle of a square wave signal.
I used the past code which I used it before for LED,

Download free bootstrap 4 landing page, free boootstrap 4 templates, Download free bootstrap 4.1 landing page, free boootstrap 4.1.1 templates, meyawo Landing page
Task 2 - Testing sensors

By: Admin 456 264

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Impedit excepturi laborum enim, vitae ipsam atque eum, ad iusto consequuntur voluptas, esse doloribus. Perferendis porro quisquam vitae exercitationem aliquid, minus eos laborum repudiandae, cumque debitis iusto omnis praesentium? Laborum placeat sit adipisci illum tempore maxime, esse qui quae? Molestias excepturi corporis similique doloribus. Esse vitae earum architecto nulla non dolores illum at perspiciatis quod, et deleniti cupiditate reiciendis harum facere, delectus eum commodi soluta distinctio sit repudiandae possimus sunt. Ipsum, rem.

Read more
Download free bootstrap 4 landing page, free boootstrap 4 templates, Download free bootstrap 4.1 landing page, free boootstrap 4.1.1 templates, meyawo Landing page
Task 3 - Coding acceleration sensor

The aim of using this sensor is to know if the ball is jumping. The sensor read the acceleration in 3 dimensions, Gyro in 3 dimension and some related information. While the sensor just take readings so we need to add something to figure out this is one jump.

Firstly, I checked the values of multiple states for the sensor (jumping, moving, elc..) and I think that will work if we just ignore the small values and see where is the big value which show there is a real change, but I notice that the main change when the sensor jump is in the acceleration in Z direction, and we also know that the acceleration will be zero at the end of going up and down so this idea will not work good.
I then think about going with delta of Z acceleration because the main change is there as you can see in the graph below.
AccelZ

To get delta of Z acceleration I need to save the past Z acceleration then take a delta after reading the new value. But while I don't need all of this values so I add If statement to remove any value of delta Z-acceleration less that 3.
This is the code after editing:
#include < Adafruit_MPU6050.h>
#include < Adafruit_Sensor.h>
#include < Wire.h>
Adafruit_MPU6050 mpu;
double AZ;
double DAccelZ;
void setup(void) {
Serial.begin(115200);
while (!Serial)
delay(10); // will pause Zero, Leonardo, etc until serial console opens
Serial.println("Adafruit MPU6050 test!");
// Try to initialize!
if (!mpu.begin()) {
Serial.println("Failed to find MPU6050 chip");
while (1) {
delay(10);
}
}
Serial.println("MPU6050 Found!");
//setupt motion detection
mpu.setHighPassFilter(MPU6050_HIGHPASS_0_63_HZ);
mpu.setMotionDetectionThreshold(1);
mpu.setMotionDetectionDuration(20);
mpu.setInterruptPinLatch(true); // Keep it latched. Will turn off when reinitialized.
mpu.setInterruptPinPolarity(true);
mpu.setMotionInterrupt(true);
Serial.println("");
delay(100); }
void loop() {
if(mpu.getMotionInterruptStatus()) {
/* Get new sensor events with the readings */
sensors_event_t a, g, temp;
mpu.getEvent(&a, &g, &temp);
DAccelZ = AZ-a.acceleration.z;
if (DAccelZ > 3){
Serial.print("D-AccelZ:");
Serial.println(DAccelZ);
}
/* Print out the values */
AZ= a.acceleration.z; }
delay(10); }

Design personal brand

By: Admin 456 264

I did a personal identity character for my website using Adobe illustrator, I start it with ready girl vector then I did some editing.
First I remove the glass and add eyebrow. I then change the girl's clothes (draw it using normal shapes and lines), and I add a mouse in the hand to add extra life in the design.
This is the ready design that I used (token from freepik website).
AccelZ Read more

Want to work with me?

Always feel Free to Contact & Hire me