Interface and application programming

Week 12

Machines and Materials

Softwares

Group Assignemt



In this assignment we are going to create an interface to control or monitor our hardware.During this week I will be using Blynk which "is a new platform that allows you to quickly build interfaces for controlling and monitoring your hardware projects from your iOS and Android device. After downloading the Blynk app, you can create a project dashboard and arrange buttons, sliders, graphs, and other widgets onto the screen." and will learn how to control a small mosotr from my phone.


Individual Assigment

Write an application that interfaces a user with an input and/or output device that you made

- Documented your process
- Explained the UI that you made and how you did it
- Outlined problems and how you fixed them
- Included original code (or a screenshot of the app code if that's not possible)
- Included a ‘hero shot/video’ of your application running with your board

Blynk
Before starting with my project I did a small research on how to develop interfaces to control hardwares. Amongs other plantforms controlling hardware (Particle, ThingSpeak, Temboo, IFTTT), Blynk is known for been the most user friendly.

"Blynk started as a Kickstarter campaign, raising just over $49k. The platform went live on May 22, and has been continuously updated since. In fact, new widgets have just been added to the app for Twitter, push, and email integration.
Currently, Blynk supports most Arduino boards, Raspberry Pi models, the ESP8266, Particle Core, and a handful of other common microcontrollers and single-board computers, and more are being added over time. Arduino Wi-Fi and Ethernet shields are supported, though you can also control devices plugged into a computer’s USB port as well."





How Blynk works

There are three major components in the platform:
Blynk App - allows to you create amazing interfaces for your projects using various widgets we provide.
Blynk Server - responsible for all the communications between the smartphone and hardware. You can use the Blynk Cloud or run your private Blynk server locally. It’s open-source, could easily handle thousands of devices and can even be launched on a Raspberry Pi.
Blynk Libraries - for all the popular hardware platforms - enable communication with the server and process all the incoming and outcoming commands.
Now imagine: every time you press a Button in the Blynk app, the message travels to the Blynk Cloud, where it magically finds its way to your hardware. It works the same in the opposite direction and everything happens in a blynk of an eye.




Before starting with Blynk this is what's needed:
(or you can follow all the steps here: https://blynk.io/en/getting-started)





Components for my project:

- Arduino (since we are still in the middle of a pandemic)
-Jumper Wires
- SG90 micro servo
- iphone or Android
- USB cable
- Breadboard


Specs
SG90 micro servo



The Micro Servo can rotate approximately 180 degrees (90 in each direction), and works just like the standard kinds but smaller. You can use any servo code, hardware or library to control these servos but for ou


Setting up Blynk
You can download it from the app store:
https://apps.apple.com/us/app/blynk-iot-for-arduino-esp32/id808760481)




First you have to make an account with your email and then you can follow these steps:


1 - Make a new project and set it up:
a. Your project name
b. Choose the devise, in our case Arduino UNO.
c. The conection, for us it will be wi-fi.
d. Copy your token

2 - Slide to the right to see the button menu

3 - We will add a "button" and a "slider"

4 - Setting up the buttons:
For the button:
Name: Led 13
Select pin: Digital 13

For the Slider:
Name: Servo
Select pin: Virtual V3
0-255

5- To run it we have to click on the upper right corenr(play) but before that we need to set up the arduino.


Setting up Arduino IDE
We start by conecting the servo to the arduino as followed:


Download Blynk's repo here:
https://github.com/blynkkk/blynk-library/releases/tag/v0.5.3)

We save it in arduino Library:



Now we go to Arduino IDE and we open Examples> Blynk> Boards_USB_Serial> Arduino_Serial_USB:



An example code will appear, we have to modify it (I already did so you can just copy it from below) but, if you try to modify it, keep in mind that the code is sensitive to caps. I faced this problem while editting my code and I had to run thru the code checking what was caps and what was not. Beside that, add the token in the space I left otherwise your Blynk wont be able to make a connection.


Code:



Almost there, now we just have to make the connexion. I tried doing it on my mac but it is way easier to do it on a windows. You can follow these steps:


1. Open command prompt

2. Copy the following
C:\Users\your username here>Documents\Arduino\libraries\Blynk\scripts\blynk-ser.bat -c COM3
(check which COM (port you are connected to)

3. Click enter and the conexion will start.



Now go back to Arduino IDE and click Upload.
Whenever I did this I had a conexion problem


Try disconecting and conecting, check your COM is correct, check if the board and port you have selcted is correct and the try uploading again.



Final results:

Go Top