Final post?

This commit is contained in:
Your Name
2026-06-04 15:44:46 +03:00
parent 1e7bb885ef
commit a0e5f97a2d
8 changed files with 120 additions and 203 deletions
-159
View File
@@ -1,159 +0,0 @@
# SulaJalmari
nRF 52840 -pohjainen pöytälelu/opetustyökalu.
## Table of Contents
- [Intro](#intro)
- [Ominaisuudet](#ominaisuudet)
- [Vaatimukset](#vaatimukset)
- [Käyttö](#käyttö)
- [Ohjelmointi](#ohjelmointi)
- [Resurssit](#resurssit)
## Intro
### SulaJalmari on nRF52840-pohjainen opetustyökalu ja pöytälelu, joka on suunniteltu tarjoamaan käytännönläheistä oppimiskokemusta sulautetuista järjestelmistä ja IoT-teknologioista.
<img src="pics/Device.jpg" height=600>
## Ominaisuudet
### Hardware:
- 2x RGB LED (silmät)
- 8x sininen LED (jalat)
- Kiihtyvyysanturi
- Tärinämoottori
- Piippari
- Bluetooth
- USB-C
### Software:
- Bootloader
- Valmiita demo-koodeja
- Ohjelmoitavissa USB:n yli
## Vaatimukset
### Demot
Demojen ohjelmoimiseen tarvitset nRF Connect for Desktop -ohjelmointityökalun ja tästä Git-reposta löytyvien demokoodien app_signed.hex-tiedostot. Tämän jälkeen siirry kohtaan: [Ohjelmointi](#ohjelmointi)
### Kehitys
Kehitystä varten tarvitset vähintään nRF Connect SDK:n ja tästä Git-reposta löytyvät "Board"-kansion tiedostot sekä pjr.conf-tiedoston. Suositeltavaa on kuitenkin aloittaa valmiista demokoodista, jossa tulee mukana kaikki tarpeelliset tiedostot ja kyseiseen demoon räätälöity pjr.conf-tiedosto. Parhaiten pääset alkuun asentamalla "nRF Connect for VS Code" -lisäosan Visual Studio Codeen. nRF Connect for VS Code -lisäosasta pääset asentamaan vaatimukset.
![Manage SDK](pics/Manage.png)
<br>
Tarvitset toolchainin sekä SDK:n.
<br>
![Install SDK](pics/Install.png)
<br>
Valitse Install SDK/Toolchain -valikosta, ja valitse sen jälkeen versio, jonka haluat asentaa. Tämän hetkinen versio on rakennettu ja todettu toimivaksi version 2.6.1 kanssa.
<br>
![SDKVER](pics/SDKVER.png)
<br>
## Käyttö
### Aloitus
Toolchainin sekä SDK:n asentamisen jälkeen voit avata valmiin demokoodin nRF Connect for VS Code -lisäosasta.
![Open](pics/OpenExisting.png)
Sovelluksen valinnan jälkeen voit aloittaa ohjelmoinnin src-kansiosta löytyvien tiedostojen avulla.
![Files](pics/ProjectView.png)
### Valmiin sovelluksen ohjelmointi laitteelle
#### Build Configuration
Build configuration vaaditaan sovelluksen build-vaihetta varten. Build configurationin voi luoda nRF Connect -lisäosan "Applications" tai "Build Configuration" -osiosta painamalla "Add Build Configuration". Mikäli "Applications"-osiossa näkyy valmis build configuration, tai projektissa on valmiiksi olemassa "Build"-kansio etkä ole itse niitä lisännyt, poista build configuration ja kansio ennen uuden lisäämistä. Toisella laitteella lisätyt build configurationit eivät välttämättä toimi laitteellasi.
Jos noudatit kehitysvaiheen ohjeita, "Add Build Configuration" -ikkunassa painaessasi "Custom Board" -valintaa, listasta löytyy laitteelle valmiiksi luotu board-tiedosto "nrf52840_qalmari".
![Build](pics/Build.png)
Painamalla "Build Configuration" -painiketta lisäät build configurationin projektiisi. Tämän jälkeen sen tulisi löytyä "Applications" -ikkunasta nRF Connect -lisäosasta.
#### Build
Jos et käyttänyt valmista demokoodia ohjelmoinnin pohjana, varmista pjr.conf-tiedoston sisältö. Laitteen bootloader vaatii ohjelmoidessaan tietyn tunnisteen, jonka Zephyr kirjoittaa app_signed.hex-tiedostoon automaattisesti vain, jos pjr.conf-tiedostosta löytyy rivi:
```
CONFIG_BOOTLOADER_MCUBOOT=y
```
Ilman tätä riviä Zephyr ei luo app_signed.hex-tiedostoa, eikä laitetta voi ohjelmoida USB:n yli.
Varmista myös että projektin sisältä lyötyy "child_image" kansio, mikäli kansiota ei löydy, luo se itse ja lisää sen sisälle "mcuboot.conf" niminen tiedosto, ja kirjoita sen sisälle rivi:
```
CONFIG_PM_PARTITION_SIZE_MCUBOOT=0x12000
```
![Build](pics/child_image.png)
Tämän jälkeen voit käyttää lisäosan "Actions"-osion "Build" -valintaa, jonka jälkeen projektikansion polkuun luodaan tarvittava .hex-tiedosto:
```
main_project/build/zephyr/app_signed.hex
```
### Ohjelmointi
Ohjelmointi tapahtuu nRF Connect for Desktop -sovelluksessa, josta valitaan "Programmer" (Programmer täytyy asentaa erikseen ennen sen käyttämistä painamalla "Install" "Open"-painikkeen tilalla).
![DesktopStart](pics/Connect_start.png)
Programmer aukeaa erilliseen ikkunaan, josta vasemmassa yläkulmassa olevasta painikkeesta "SELECT DEVICE" aukeaa lista käytettävissä olevista USB-laitteista. Näistä valitaan MCUBOOT.
![Select](pics/programmer_not_chosen.png)
Laitteen valinnan jälkeen aukeaa uusi ikkuna, josta löytyy lista vaihtoehtoja. Tämän jälkeen voit navigoida app_signed.hex-tiedostoon painamalla "Add File" -painiketta. Vaihtoehtoisesti tiedoston voi vetää ja pudottaa "File Memory Layout" -kenttään.
![Selected](pics/programmer_chosen.png)
Kun tiedosto on lisätty ohjelmointityökaluun, vihreä alue ilmestyy "File Memory Layout" -kenttään visualisoimaan sovelluksen aloitusosoitetta ja sovelluksen kokoa verrattuna käytettävissä olevaan muistiin.
![Hex](pics/programmer_hex.png)
Tämän jälkeen on mahdollista ohjelmoida laite painamalla "Write" -painiketta.
![Program](pics/programmer_program.png)
Uudessa ikkunassa voit painaa taas "Write".
Jos laite ohjelmoitiin onnistuneesti, oranssin kentän tilalle ilmestyy vihreä kenttä, jossa lukee "Completed successfully in X seconds."
## Resurssit
Tästä osiosta löydät tarvittavat kehittämiseen.
Suositellut nRF lisäosat VS Codeen (nRF Terminal vanhentunut): <br>
![Ext](pics/ext.png)
- nRF Connect for Desktop:
https://www.nordicsemi.com/Products/Development-tools/nRF-Connect-for-Desktop
- nRF Command Line Tools:
https://www.nordicsemi.com/Products/Development-tools/nRF-Command-Line-Tools/Download?lang=en#infotabs
- Kconfig-komennot (pjr.conf):
https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/kconfig/ (Offline 18/6/2024) <br>
https://docs.zephyrproject.org/latest/kconfig.html (Backup)
- Dokumentaatiot:
https://docs.nordicsemi.com/category/nrf52840-category (nRF52840) <br>
https://invensense.tdk.com/wp-content/uploads/2016/10/DS-000176-ICM-20602-v1.0.pdf (ICM-20602 kiihtyvyysanturi) <br>
https://docs.zephyrproject.org/latest/index.html (Zephyr project) <br>
- EasyEDA:
Projektin kytkentäkaaviot sekä linkki projektin EasyEDA sivulle löytyy tämän Git-repon kansiosta Hardware/Prototype2
+1 -1
View File
@@ -1,6 +1,6 @@
# Octopus Flex PCB (SulaJalmari)
nRF52840-based flex PCB project with a shape of an octopus. Because why not.
nRF52840-based flex PCB project with a shape of an octopus. Because why not. You can read the story from [final.md](final.md).
<img src="pics/device_diagram.png" height=800>
+81
View File
@@ -0,0 +1,81 @@
# The Flex-PCB Octopus device
<img src="pics/device_diagram.png" height=800>
[SulaJalmari](https://git.aintmina.org/aintgit/SulaJalmari)
### What is this wobbly device?
At first glance, you might think we built an elaborate paperweight, but it's probably not even heavy enough for that. This is me and my friends first take on designing an MCU PCB, and of course we had to overengineer it and make it as complicated as possible. But where's the fun of making things easy.
This device was not created to serve a purpose, but to teach us PCB design and project work. It ended up as a flashy desk toy which wobbles on slightest movement, but also gains attention by confusing people around it.
### Story
The story started when laying on sofa, staring at the ceiling, I got the idea of creating a flex-PCB and have it be 3-dimentional. The shape was easy, since I worked in a company called [Qalmari](https://qalmari.fi/en/) and their mascot is an octopus which was perfect for this project (also perfect for getting the company to pay for this expensive project :D).
First step was to create a paper cutout and message my friend if he wants to collaborate on this project. I grabbed some cheap whiskey, we got components for whiskey sour (first time making it), and started designing the project.
<img src="pics/paper_model_v1.jpg" height=600>
We wanted to have bluetooth on it, but our school project with nRF chip was a disaster and we started to hate it and zephyr. But still, we decided to give it another chance and use the nRF52840 as the MCU.
I love creating weird and useless projects and I'm extremely proud of this one. This tought us so much, we got a cool project for our portfolio/CV, and we got an actual device on our desk as a reminder for this.
### Prototype 1
<img src="pics/prototype1-3.jpg" height=600>
The first prototype was designed while learning to make whiskey sour, and the result was not that good (who would've guessed). We had so many DRC errors, since we didn't set any design rules and the tolerances were too small for them, we missed a critical flaw of an accidental via from 3V3 straight to GND.
When receiving the prototype, we didn't know this and didn't have tools to find it, so we just pumped some current through and found that one leg had the whole track turning black. But this prototype proved that the mechanical concept was legit.
### Prototype 2
For the second version, we switched from yellow to black/blue, to contrast the company colors and it looked way better than the first prototype. This time, we followed and solved all the DRC errors and got the device to work.
But this one was NOT without problems. Turns out, clamping to debug pins on the flex-PCB was eventually fatal to the pins and we lost access to debugging on many of the devices. We also did a lot of stress testing by smashing the device flat, to see if it can take it, and it did... for a while. After stressing it for a while, we found that some pins from the MCU got disconnected from the PCB and the device did not work properly without pushing on the chip.
<img src="pics/pushing_down_mcu.jpg" height=600>
### Prototype 3
<img src="pics/army.jpg" height=600>
After breaking all the second stage prototypes, we decided to do final batch as "ready" devices. This fixed the debug pins and added a stiffener on the other side of the MCU to protect the pins. We also noticed that the vibration motor did not function as we wanted, so we didn't assemble it on the final device.
### Hardware
If you're crazy enough to want to get your own expensive useless device, then the hardware files are freely available at my [git](https://git.aintmina.org/aintgit/SulaJalmari) as gerbers and diagrams. This was designed in EasyEDA for the convenience of not having to build our own component library, but this has made releasing the CAD project difficult...
* **CPU:** nRF52840-QIAA MCU (on a flex PCB).
* **Sensors:** ICM-20602 IMU and XYC-ALS21C-K1 I2C Ambient Light Sensor.
* **Fun stuff:** 2x WS2812B RGB LEDs (the eyes), 8x blue indicator LEDs, Buzzer/Vibration Motor mounts, 2x user buttons.
* **Power:** TP4054 battery charger, two separate LDOs (3V3 and 3.6V).
* **Structure:** Two custom flex PCBs (Head & Legs) attached to a main FR4 base board.
**Assembly:** Even though the PCBs were fabricated and assembled by JLCPCB, they still needed to be soldered together by hand, since JLC does not offer octopus assembly (yet?). We initially designed the feet and head assembly with magnets on the PCB and legs, but it did not work on the paper version as intended as the legs just kept getting tangled up. For the second and third prototypes we settled on solder pads with needle holes for alignment and assembly, which worked well for most part. But still some of the assembled devices stood a bit crooked as even a slight misalignment was exaggerated when it was standing.
**Base:** We designed a 3D-printed stand that attaches to the base with *some* room for a small battery, nothing fancy but it does the job and looks good in the final assembly.
<img src="pics/smack.gif">
### One framework to rule them all - ZephyrRTOS
As mentioned, we came accross nRF and zephyr in a school project, where we just had to get familiar and do a small project with `nrf52840-dk`. Zephyr development is so fast that this turned out to be a hunt for correct documentation, since everything we found was already deprecated. Zephyr also uses devicetree and kconfig to configure the hardware, and this was new to us back then, hence also having trouble with that aspect.
> *Since the second prototype, zephyr version has nearly doubled, which shows how active the development is. Or how slow we are.*
Nowdays, I try to use zephyr for everything. The fact that you don't need to learn a new framework for every single MCU, makes zephyr a very powerful tool for testing and development. And their extensive support for all sorts of hardware (you can even run zephyr on Cortex-A cores), makes it easy to just configure the hardware in devicetree and use the drivers in the kernel. Zephyr also makes bootloading easy, by supporting `MCUboot` "out-of-the-box", where you just need to configure it with few kconfigs and get it working.
Now, zephyr is not perfect and still has the problem of constantly changing things to make it harder for developers, but it is better for the greater good of making zephyr better and doing it fast.
### Conclusion
This is one of my favourite projects, and while being a useless but cool piece of technology, I've still had time to figure out a use for it. For the past months, I've been vibe developing (with my limited energy after burnout) probably the only useful app for it. It's a "pomodoro" like app, that loads for X amount of minutes with the LED lights and then flashes the "eye" LED's for Y amount of seconds to indicate when to take a break after staring at the screen all the time. This is found in my [chill](https://git.aintmina.org/aintgit/chill) repo.
<img src="pics/imu_testing_logic.jpg" height=600>
Looking at the I2C line with logic analyzer.
### Thanks
* Thank you for my friend for helping me empty the bottle of whiskey and collaborate on this project full time.
* [Qalmari](https://qalmari.fi/en/) for sponsoring my dumb ideas and supporting us to learn and improve as engineers.
* Hackaday Europe 2026 for showing interest and urge me to share this project. (If you saw me there, say hi in the comments)
<img src="pics/hackaday.jpg" height=600>
File diff suppressed because one or more lines are too long
Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 MiB

After

Width:  |  Height:  |  Size: 1.4 MiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 MiB

+1 -6
View File
@@ -44,12 +44,8 @@
- one framework to rule them all (no need to learn framework for every MCU)
- gained embedded linux and devicetree experience
- custom board files uses nrf52840-dk as template
- Arduino
- modified adafruit nrf52 library to work with arduino
- added some custom examples (like IMU)
- Bootloaders
- zephyr uses MCUboot as bootloader
- arduino uses modified adafruit nrf52 bootloader for arduino
## Story
- Idea came to me when sitting on sofa after watching flex pcb videos on youtube(insert channel here)
@@ -71,7 +67,7 @@
- also fixing some mistakes and adding more functionality (got feedback from the companys senior embedded developers)
- after fiddling with it with debugger, we managed to get the LED working. (didn't add a 32k clock, so had troubles configuring it and it kept crashing)
- Third batch was 10pcs (as "ready product")
- this batch worked and was ready for software integration and example codes (zephyr and arduino)
- this batch worked and was ready for software integration and example codes (zephyr)
- this became a desk toy for the company, for technical and non-technical co-workers, so had to be easy to use
## Fun things
@@ -100,7 +96,6 @@
- schematics
- SW
- MCUBoot
- Arduino bootloader
- Zephyr board files and examples
- Pics
- Paper prototype