-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
30 changed files
with
87,106 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,6 @@ | ||
# Prerequisites | ||
*.d | ||
|
||
# Compiled Object files | ||
*.slo | ||
*.lo | ||
*.o | ||
*.obj | ||
|
||
# Precompiled Headers | ||
*.gch | ||
*.pch | ||
|
||
# Compiled Dynamic libraries | ||
*.so | ||
*.dylib | ||
*.dll | ||
|
||
# Fortran module files | ||
*.mod | ||
*.smod | ||
|
||
# Compiled Static libraries | ||
*.lai | ||
*.la | ||
*.a | ||
*.lib | ||
|
||
# Executables | ||
*.exe | ||
*.out | ||
*.app | ||
.pioenvs | ||
.piolibdeps | ||
.clang_complete | ||
.gcc-flags.json | ||
.pio | ||
.vscode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,51 @@ | ||
# Rocket-model-with-live-acceleration-view | ||
This repository contains files for building a 3D model rocket and code to use with ESP32 microcontroller on board for live view acceleration data using ESPNow protocol | ||
<h1 align="center">Welcome to Rocket-model-with-live-acceleration-view 👋</h1> | ||
<p> | ||
<a href="#" target="_blank"> | ||
<img alt="License: MIT" src="https://img.shields.io/badge/License-MIT-yellow.svg" /> | ||
</a> | ||
</p> | ||
|
||
--- | ||
|
||
# Rocket Model with ESP32 Communication | ||
|
||
This project involves designing and simulating a rocket model using OpenRocket and FreeCAD, combined with real-time acceleration through ESP32-based communication. The main goal was to achieve live communication between the rocket and the ground using ESPNow protocol, allowing for low-latency, peer-to-peer data exchange during the flight. Additionally, a buzzer system was implemented to recover rocket after landing. | ||
|
||
## Features | ||
- **Rocket Design**: Base for rocket model was designed in [OpenRocket](https://openrocket.info/) which also enables flight simulations. For further processing [FreeCAD](https://www.freecad.org/) was helpful. All parts are available in [model directory](model/stl_files/) | ||
- **Motors**: Rocket motors used: [A6-4, B4-4](https://www.scorpio-polska.pl/katalog/klima/klima-silnik-rakietowy-a6-4-b4-4-c6-7-2-2-2-p68365.html) and [PS-16-A](https://www.modelmania.eu/silnik-do-rakiety-ps-16-a-1szt-125935) | ||
- **Embedded programming**: Utilized ESP32 development boards for their built-in Wi-Fi capabilities, enabling real-time communication between the rocket and ground station using the ESPNow protocol. Two ESP32 boards were used: Seeed Studio XIAO ESP32C3 (transmitter) and [ESP32-Pico](https://shop.m5stack.com/products/m5stickc-plus-esp32-pico-mini-iot-development-kit) (receiver) which was build in M5StickC plus, both programmed using [PlatformIO](https://platformio.org/). | ||
- **Flight Recovery**: Integrated a parachute and buzzer system, programmed using interrupts, to assist in locating the rocket post-flight. | ||
- **Data processing**: Python helps with live data projection and collecting it to csv file. | ||
|
||
## Technologies Used | ||
- **OpenRocket**: For simulating the rocket's flight dynamics. | ||
- **FreeCAD**: For 3D modeling and design. | ||
- **ESP32 with ESPNow**: For wireless communication between the rocket and ground control. | ||
- **Python**: For collecting data from serial port and data poltting. | ||
|
||
## Resources | ||
Here are some helpful resources I used throughout this project: | ||
- [ESP32 Wireless Communication Protocols](https://randomnerdtutorials.com/esp32-wireless-communication-protocols/) | ||
- [Gravity I2C Triple Axis Accelerometer - LIS2DH](https://wiki.dfrobot.com/Gravity__I2C_Triple_Axis_Accelerometer_-_LIS2DH_SKU_SEN0224) | ||
- [ESPNow Unicast Example](https://github.com/yoursunny/WifiEspNow/blob/main/examples/EspNowUnicast/EspNowUnicast.ino) | ||
- [Seeed Studio XIAO ESP32C3 Getting Started Guide](https://wiki.seeedstudio.com/XIAO_ESP32C3_Getting_Started/) | ||
|
||
--- | ||
|
||
### 🏠 [Homepage](Demo) | ||
|
||
<video src="flight_data/flight_slow_motion.mp4" width="320" height="200" controls preload></video> | ||
<video src="flight_data/flight.mp4" width="320" height="200" controls preload></video> | ||
|
||
 | ||
|
||
## Author | ||
|
||
👤 **Piotr Koronczok** | ||
|
||
* Github: [@triplo098](https://github.com/triplo098) | ||
* LinkedIn: [@Piotr Koronczok](https://www.linkedin.com/in/piotr-koronczok-b52b012a9/) | ||
|
||
*** | ||
_This README was generated with ❤️ by [readme-md-generator](https://github.com/kefranabg/readme-md-generator)_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
.pio | ||
.vscode/.browse.c_cpp.db* | ||
.vscode/c_cpp_properties.json | ||
.vscode/launch.json | ||
.vscode/ipch |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
|
||
This directory is intended for project header files. | ||
|
||
A header file is a file containing C declarations and macro definitions | ||
to be shared between several project source files. You request the use of a | ||
header file in your project source file (C, C++, etc) located in `src` folder | ||
by including it, with the C preprocessing directive `#include'. | ||
|
||
```src/main.c | ||
|
||
#include "header.h" | ||
|
||
int main (void) | ||
{ | ||
... | ||
} | ||
``` | ||
|
||
Including a header file produces the same results as copying the header file | ||
into each source file that needs it. Such copying would be time-consuming | ||
and error-prone. With a header file, the related declarations appear | ||
in only one place. If they need to be changed, they can be changed in one | ||
place, and programs that include the header file will automatically use the | ||
new version when next recompiled. The header file eliminates the labor of | ||
finding and changing all the copies as well as the risk that a failure to | ||
find one copy will result in inconsistencies within a program. | ||
|
||
In C, the usual convention is to give header files names that end with `.h'. | ||
It is most portable to use only letters, digits, dashes, and underscores in | ||
header file names, and at most one dot. | ||
|
||
Read more about using header files in official GCC documentation: | ||
|
||
* Include Syntax | ||
* Include Operation | ||
* Once-Only Headers | ||
* Computed Includes | ||
|
||
https://gcc.gnu.org/onlinedocs/cpp/Header-Files.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
|
||
This directory is intended for project specific (private) libraries. | ||
PlatformIO will compile them to static libraries and link into executable file. | ||
|
||
The source code of each library should be placed in an own separate directory | ||
("lib/your_library_name/[here are source files]"). | ||
|
||
For example, see a structure of the following two libraries `Foo` and `Bar`: | ||
|
||
|--lib | ||
| | | ||
| |--Bar | ||
| | |--docs | ||
| | |--examples | ||
| | |--src | ||
| | |- Bar.c | ||
| | |- Bar.h | ||
| | |- library.json (optional, custom build options, etc) https://docs.platformio.org/page/librarymanager/config.html | ||
| | | ||
| |--Foo | ||
| | |- Foo.c | ||
| | |- Foo.h | ||
| | | ||
| |- README --> THIS FILE | ||
| | ||
|- platformio.ini | ||
|--src | ||
|- main.c | ||
|
||
and a contents of `src/main.c`: | ||
``` | ||
#include <Foo.h> | ||
#include <Bar.h> | ||
|
||
int main (void) | ||
{ | ||
... | ||
} | ||
|
||
``` | ||
|
||
PlatformIO Library Dependency Finder will find automatically dependent | ||
libraries scanning project source files. | ||
|
||
More information about PlatformIO Library Dependency Finder | ||
- https://docs.platformio.org/page/librarymanager/ldf.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
; PlatformIO Project Configuration File | ||
; | ||
; Build options: build flags, source filter | ||
; Upload options: custom upload port, speed and extra flags | ||
; Library options: dependencies, extra library storages | ||
; Advanced options: extra scripting | ||
; | ||
; Please visit documentation for the other options and examples | ||
; https://docs.platformio.org/page/projectconf.html | ||
|
||
[env:pico32] | ||
platform = espressif32 | ||
board = pico32 | ||
framework = arduino | ||
lib_deps = yoursunny/WifiEspNow@^0.0.20230713 | ||
upload_speed = 115200 | ||
monitor_speed = 115200 | ||
; ; upload_flags = --no-stub | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
/** | ||
* @file | ||
* | ||
* EspNowUnicast.ino demonstrates how to transmit unicast ESP-NOW messages with @c WifiEspNow . | ||
* You need two ESP8266 or ESP32 devices to run this example. | ||
* | ||
* Unicast communication requires the sender to specify the MAC address of the recipient. | ||
* Thus, you must modify this program for each device. | ||
* | ||
* The recommended workflow is: | ||
* @li 1. Flash the program onto device A. | ||
* @li 2. Run the program on device A, look at serial console for its MAC address. | ||
* @li 3. Copy the MAC address of device A, paste it in the @c PEER variable below. | ||
* @li 4. Flash the program that contains A's MAC address onto device B. | ||
* @li 5. Run the program on device A, look at serial console for its MAC address. | ||
* @li 6. Copy the MAC address of device B, paste it in the @c PEER variable below. | ||
* @li 7. Flash the program that contains B's MAC address onto device A. | ||
*/ | ||
|
||
/**! | ||
* @file getAcceleration.ino | ||
* @brief Get the acceleration in the three directions of xyz, the range can be ±2g、±4g、±8g、±16g | ||
* @copyright Copyright (c) 2010 DFRobot Co.Ltd (http://www.dfrobot.com) | ||
* @license The MIT License (MIT) | ||
* @author [tangjie](jie.tang@dfrobot.com) | ||
* @version V1.0 | ||
* @date 2021-01-16 | ||
* @url https://github.com/DFRobot/DFRobot_LIS | ||
*/ | ||
|
||
// CODE FOR ESP32_receiver | ||
|
||
#include <WifiEspNow.h> | ||
#if defined(ARDUINO_ARCH_ESP8266) | ||
#include <ESP8266WiFi.h> | ||
#elif defined(ARDUINO_ARCH_ESP32) | ||
#include <WiFi.h> | ||
#endif | ||
|
||
static uint8_t PEER[]{0xD4, 0xD4, 0xDA, 0x96, 0xFF, 0x65}; // MAC addres of ESP32_transmiter | ||
|
||
void printReceivedMessage(const uint8_t mac[WIFIESPNOW_ALEN], const uint8_t *buf, size_t count, | ||
void *arg) | ||
{ | ||
for (int i = 0; i < static_cast<int>(count); ++i) | ||
{ | ||
Serial.print(static_cast<char>(buf[i])); | ||
} | ||
Serial.println(); | ||
} | ||
|
||
void setup() | ||
{ | ||
// Setting up serial | ||
Serial.begin(115200); | ||
Serial.println(); | ||
|
||
// Setting up ESPNOW protocol | ||
WiFi.persistent(false); | ||
WiFi.mode(WIFI_AP); | ||
WiFi.disconnect(); | ||
WiFi.softAP("ESPNOW", nullptr, 3); | ||
WiFi.softAPdisconnect(false); | ||
// WiFi must be powered on to use ESP-NOW unicast. | ||
// It could be either AP or STA mode, and does not have to be connected. | ||
// For best results, ensure both devices are using the same WiFi channel. | ||
|
||
Serial.print("MAC address of this node is "); | ||
Serial.println(WiFi.softAPmacAddress()); | ||
|
||
uint8_t mac[6]; | ||
WiFi.softAPmacAddress(mac); | ||
Serial.println(); | ||
Serial.println("You can paste the following into the program for the other device:"); | ||
Serial.printf("static uint8_t PEER[]{0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X};\n", mac[0], | ||
mac[1], mac[2], mac[3], mac[4], mac[5]); | ||
Serial.println(); | ||
|
||
bool ok = WifiEspNow.begin(); | ||
if (!ok) | ||
{ | ||
Serial.println("WifiEspNow.begin() failed"); | ||
ESP.restart(); | ||
} | ||
|
||
WifiEspNow.onReceive(printReceivedMessage, nullptr); | ||
|
||
ok = WifiEspNow.addPeer(PEER); | ||
if (!ok) | ||
{ | ||
Serial.println("WifiEspNow.addPeer() failed"); | ||
ESP.restart(); | ||
} | ||
} | ||
|
||
void loop() | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
|
||
This directory is intended for PlatformIO Test Runner and project tests. | ||
|
||
Unit Testing is a software testing method by which individual units of | ||
source code, sets of one or more MCU program modules together with associated | ||
control data, usage procedures, and operating procedures, are tested to | ||
determine whether they are fit for use. Unit testing finds problems early | ||
in the development cycle. | ||
|
||
More information about PlatformIO Unit Testing: | ||
- https://docs.platformio.org/en/latest/advanced/unit-testing/index.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
.pio | ||
.vscode/.browse.c_cpp.db* | ||
.vscode/c_cpp_properties.json | ||
.vscode/launch.json | ||
.vscode/ipch |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
cmake_minimum_required(VERSION 3.16.0) | ||
include($ENV{IDF_PATH}/tools/cmake/project.cmake) | ||
project(rakieta_1_2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
|
||
This directory is intended for project header files. | ||
|
||
A header file is a file containing C declarations and macro definitions | ||
to be shared between several project source files. You request the use of a | ||
header file in your project source file (C, C++, etc) located in `src` folder | ||
by including it, with the C preprocessing directive `#include'. | ||
|
||
```src/main.c | ||
|
||
#include "header.h" | ||
|
||
int main (void) | ||
{ | ||
... | ||
} | ||
``` | ||
|
||
Including a header file produces the same results as copying the header file | ||
into each source file that needs it. Such copying would be time-consuming | ||
and error-prone. With a header file, the related declarations appear | ||
in only one place. If they need to be changed, they can be changed in one | ||
place, and programs that include the header file will automatically use the | ||
new version when next recompiled. The header file eliminates the labor of | ||
finding and changing all the copies as well as the risk that a failure to | ||
find one copy will result in inconsistencies within a program. | ||
|
||
In C, the usual convention is to give header files names that end with `.h'. | ||
It is most portable to use only letters, digits, dashes, and underscores in | ||
header file names, and at most one dot. | ||
|
||
Read more about using header files in official GCC documentation: | ||
|
||
* Include Syntax | ||
* Include Operation | ||
* Once-Only Headers | ||
* Computed Includes | ||
|
||
https://gcc.gnu.org/onlinedocs/cpp/Header-Files.html |
Oops, something went wrong.