Skip to content

Commit 12880dc

Browse files
Update README.md
1 parent 6355f37 commit 12880dc

File tree

1 file changed

+53
-53
lines changed

1 file changed

+53
-53
lines changed

README.md

Lines changed: 53 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,78 +1,78 @@
11
# 📦 CAN Accelerometer Logger
2+
is a small STM32-based project that reads 3-axis acceleration data from an ADXL345 sensor, buffers it for 1 second at 1 kHz, and then transmits it via UART and CAN bus. Perfect for capturing impact or vibration events in embedded systems.
23

34
[![License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
45
[![Platform](https://img.shields.io/badge/platform-STM32-blue.svg)]()
56
[![Interface](https://img.shields.io/badge/interface-CAN%2FUART-green.svg)]()
67
[![Status](https://img.shields.io/badge/status-Development-yellow.svg)]()
78

8-
A compact STM32-based motion sensor module using an ADXL345 digital accelerometer.
9-
This device logs 3-axis acceleration data at 1 kHz for 1 second (1000 samples) and then transmits the data via **CAN** and **UART**.
10-
11-
---
12-
139
## 🚀 Features
1410

15-
- ✅ SPI communication with ADXL345
16-
- ✅ Buffered sampling at **1 kHz** for 1 second
17-
- ✅ Data output via:
18-
- UART (CSV format)
19-
- CAN bus (fragmented transfer with optional header and CRC)
20-
- ✅ Trigger via GPIO (e.g. rising edge or external button)
21-
- ✅ Visual feedback via onboard LED
22-
23-
---
24-
25-
## 🧠 Technical Overview
11+
- 🧭 3-axis accelerometer data from ADXL345 via SPI
12+
- ⏱️ 1000 samples per second (1 kHz), total 1000 samples in buffer
13+
- 🟢 Trigger signal via GPIO (rising edge)
14+
- 💾 Data is buffered in RAM, sent after acquisition
15+
- 📤 Data output via UART and optionally via CAN
16+
- 📦 CAN data transmission in chunks with custom protocol
17+
- 🧪 Simple and compact C code, ideal for lab testing or automotive debug setups
2618

27-
| Feature | Value |
28-
|----------------|--------------------------|
29-
| MCU | STM32G4xx (e.g. G431) |
30-
| Sensor | ADXL345 (±8g range) |
31-
| Sampling Rate | 1000 Hz (1 kHz) |
32-
| Buffer Size | 1000 samples (x,y,z) |
33-
| Interface | SPI (ADXL), UART, CAN |
34-
| CAN Speed | 500 kbit/s |
35-
| CRC | CRC8 for data integrity |
19+
## ⚙️ Requirements
3620

37-
---
21+
STM32 microcontroller with:
3822

39-
## ⚙️ Trigger Modes
23+
- SPI (ADXL345)
24+
- UART (for output)
25+
- GPIO (for trigger input)
26+
- CAN (for data transmission)
27+
- ADXL345 accelerometer (3.3 V logic)
28+
- STM32CubeMX / STM32CubeIDE (for initial setup)
4029

41-
| Mode | Description |
42-
|------------|--------------------------------------|
43-
| GPIO | Starts on rising edge |
44-
| Button | Optional fallback (User button) |
30+
## 🔌 Wiring
4531

46-
---
32+
| Signal | STM32 Pin | ADXL345 |
33+
|--------------|------------|----------------|
34+
| SPI MOSI | e.g. PA7 | SDI |
35+
| SPI MISO | e.g. PA6 | SDO |
36+
| SPI SCK | e.g. PA5 | SCL |
37+
| SPI CS | e.g. PB0 | CS |
38+
| Trigger Input| e.g. PA8 | (external source) |
39+
| UART TX | e.g. PA9 | (debug terminal) |
40+
| CAN TX / RX | any FDCAN-capable pins |
4741

48-
## 🖧 CAN Communication
42+
## 🧪 Example Workflow
4943

50-
- The device sends a header frame with total data length.
51-
- Followed by multiple frames (8 bytes each).
52-
- Designed to work with another STM32 as a CAN receiver & I2C bridge.
44+
1. Startup
45+
2. Wait for trigger input (PA8 HIGH)
46+
3. Sample 1000 accelerometer values (XYZ)
47+
4. After sampling:
48+
- Send data over UART (CSV format)
49+
- Send header + chunked payload via CAN
5350

54-
---
51+
## 💬 CAN Protocol Overview
5552

56-
## 📡 UART Output
53+
- **Request:** ID 0x123, single byte 0xAB to request data
54+
- **Header:** ID 0x321, first frame = 2 bytes length (e.g. 0x27 0x11 = 10001)
55+
- **Payload:** subsequent frames with raw buffer data
5756

58-
- Data is streamed as comma-separated values (CSV):
59-
```
60-
124,0,-1032
61-
123,1,-1033
62-
...
63-
```
57+
## 📂 Folder Structure
6458

65-
---
59+
```
60+
CAN_Accelerometer_Logger/
61+
├── Core/
62+
│ ├── Src/
63+
│ └── Inc/
64+
├── Drivers/
65+
├── .gitignore
66+
├── README.md
67+
└── LICENSE (CC0-1.0)
68+
```
6669

67-
## 🛠️ Build Requirements
70+
## 📄 License
6871

69-
- STM32CubeIDE or Makefile toolchain
70-
- STM32G4 family MCU (e.g. Nucleo-G431RB)
71-
- ADXL345 accelerometer
72-
- Proper CAN transceivers (e.g. TJA1050)
72+
This project is licensed under [CC0 1.0 Universal](https://creativecommons.org/publicdomain/zero/1.0/) (Public Domain Dedication). You can use it without attribution – though a ⭐ on GitHub is always appreciated :)
7373

74-
---
74+
## ✨ Credits
7575

76-
## 📎 License
76+
Made with ❤️ by **Styria Electronics** for high-performance embedded data acquisition over CAN bus.
7777

78-
This project is licensed under the MIT License.
78+
🛠️ Contributions welcome!

0 commit comments

Comments
 (0)