Skip to content

FrigoMatteo/Embedded_project

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

52 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Solar Panel embedded project

Index:

  1. Preview of the Project
  2. Tools configuration
  3. Collaborators
  4. Links

Preview of the project

Hi, welcome to our solar panel project for embedded system.
The idea of this project was to change the way to manage the solar panels.
Since the controlling of solar panels can be difficult or time consuming, we wanted to garantee a way for a user to check them by remote, where we can give him some information about, simply by using a website on their smartphone or computer.
In our system we use:

  • MSP432 P401R, it's the master device, where, based on some input related to the solar panel and some other conditions, he will decide whether to send a messagge to our user.
  • ESP32, we use this microcontroller for the wi-fi module. Obviously useful if we need to communicate with the user about the solar panel status.
  • DHT20 humidity/temperature sensor, we use this sensor to check and make some controlls about the humidity and temperature in the area close to our solar panels.
  • Embedded light sensor, we use this sensor to compare the light with the value returned by our solar panels.
  • INA219 power sensor, we use this sensor to effectivly register the Watt produced by the solar panel.
  • Solar panels, those are devices we have to check.
  • MQTT Server, is a light-weight messaging protocol used to communicate between machines, using a centralized server.

The system works by constantly monitoring our solar panels, where based on some pre-registered value we evaluate if it is properly working.
The pre-register data comes from ideal conditions of the solar panel, such as sunny day, cleaned solar panel etc. Then, by using those data, we compare with what we got from the solar panels and we make the decisions.

For those kind of process, we also consider the weather conditions, since he can critically affect the functionality of the solar panel. In fact, by using temperature, humidity and brightness sensor we can figure out if our solar panel isn't working for that reason, or other related conditions.

Project view

Solar Panel project:
├── ccsProject
│   ├── main.c                     # Main code of the MSP432
│   └── Hardware                   # We initialize the hardware of our devices
|       ├── hardware_init          # Initialize the sensors and MSP432 modules
|       ├── Graphic                # Graphic part of the MSP432
|       ├── LcdDriver              # Drivers of the MSP432 LCD
|       └── luxDriver              # Drivers of the integrated MSP432 lux sensor
├── ESP32
│   ├── main.ino                   # Main code of the ESP32
│   ├── Wifi                       # Include libraries for the Wifi connection
│   ├── PubSubClient               # Include libraries for MQTT connection
├── serverProject
│   ├── BlogicDB.java              # It handle the databases operations
│   ├── mqtt-client.js             # Useful functions for the web-application
│   ├── mqttws31.js                # Main library of the MQTT server
├── Read_me_Images
│   └── images                     # Images for the Readme file
└── README.md

Used hardware

The main hardware we used is a MSP432p401r and a ESP32. Those two are the main components of our project, since are the one who process the received data from sensors or external input.
The MSP432p401r is a ultra-low-power mixed-signal microcontroller, configured with an ARM Cortex-M4 processor. Next we are going to use his integreted lux sensor and the UART connection to communicate with the ESP and the other sensors.

Software IDE for MSP432

To flash the wanted program into the microcontroller, we need to use a specific software given by the Texas Instrument Company, called Code Composer Studio. This software let us use our microcontroller.

The last process before using our microcontroller, it's to install and include some specific usefull libraries for the implementation of the project. To install those libraries, you can find them here.
To include those libraries you need to insert them inside your project propriety at the following paths:

ARM linker

ARM compiler

Tools configurations:

Follow the schema below in the picture and connect all the sensors and microcontrollers to each other.
Try to keep the same ports and pins number, since they are fondamental for the functioning of the project:

MSP432 initialization:

When you create your CCS project with all the related files inside our folder folder CCS, make sure to implement all the libraries of before. After that, you need to flash the memory into the MSP432 by launching this command in the CCS program:

After uploading the flash inside the MSP432, you should see a screen like that appearing on your LCD:

ESP32 initialization:

First, if you haven't done it yet, you need to install the Arduino IDE, you can find the link here .
You need also the library for the MQTT communication:

We created a specific folder for the ESP32 code esp32 , where in the esp32_mqtt.ino you can find the code you need to flash in the ESP32 memory.
In esp32_mqtt.ino you have to modify the following code:

// Wi-Fi setting
const char* ssid = "/* WiFi name */";
const char* password = "/* WiFi password */";

// MQTT setting
const char* ipServer = "/* MQTT server IP */";
const int mqttPort = 1883;                // default server communication port
const char* mqttUser = "MPS432";          // casual name
const char* mqttPassword = "";            // left it empty it's not request

After finding the file, you need to connect the ESP32 to your computer and flash the program into the ESP32 memory with this command:

With the code you have just flashed, we can manage to connect with two of our devices:

  • MQTT server, so we can send and receive data from our server.
  • ESP32 UART connection to our MSP432, so we can send and get information about our connected sensors.

Initialization of the MQTT server

After doing so, we install the components for initialize the MQTT server. You need to follow those steps:

  • You can find the link to download it: https://mosquitto.org/download/
  • Open the command line as administrator.
  • After opening the command line, you need to go to the mosquito directory, the folder where the mosquito download is.
  • Then, we need to start the server with this command:
  •   mosquitto -v -c mosquitto.conf 
    
  • If you have correctly followed all the step of before, you should see those kind of replies:
  • After that, each communication that pass throught the server could be read on this command line. The information that will be shown are:

    • star/end connection of a Client
    • subscribtion to a topic for a Client
    • message sending(topic name, payload weight, sender)

    Creation of the Web App

    We used VSCode to create a web application to implement some features, such as:

    • change the sensor reading frequency
    • view table for last registered sensor data
    • get data from a Postgres database

    If you don't know how to create a web-application, these links can help you:

    Once you built your project with Maven and add the demployment on the Tomcat server, you can reach your web-app at the link: www.localhost:8080/solar_panel_webapp/

    Web-Application project structure:

    SOLAR_PANEL_WEBAPP:
    ├── src\main
    │   ├── java\web
    │   │   ├── BLogicDB.java
    │   │   └── GetinMax.java
    │   └── webapp
    |       ├── css
    |       |   └── style.css
    |       ├── js
    |       |   ├── mqtt-client.js
    |       |   └── mqttws31.js
    |       ├── WEB-INF
    |       |   └── web.xml
    │       └── index.jsp
    ├── pom.xml
    └── README.txt
    

    Authors

    • Matteo Frigo
      • UART communication
      • Light sensor
      • ESP32 code
      • Testing part
    • Quentin Meneghini
      • Graphic view
      • MSP432 code structure
      • Temperature/humidity and current sensors
      • Electrical wiring
    • Alberto Messa
      • Graphic view
      • Web application
      • MQTT server
      • ESP32 code

    Links

    About

    No description, website, or topics provided.

    Resources

    Stars

    Watchers

    Forks

    Releases

    No releases published

    Packages

    No packages published

    Contributors 2

    •  
    •