Pienoismalli nostosillan ohjausautomaation toteutus: Sulautettu järjestelmä Raspberry Pilla
Laurikainen, Aatu (2025)
Laurikainen, Aatu
2025
Teknisten tieteiden kandidaattiohjelma - Bachelor's Programme in Engineering Sciences
Tekniikan ja luonnontieteiden tiedekunta - Faculty of Engineering and Natural Sciences
Hyväksymispäivämäärä
2025-07-31
Julkaisun pysyvä osoite on
https://urn.fi/URN:NBN:fi:tuni-202507317954
https://urn.fi/URN:NBN:fi:tuni-202507317954
Tiivistelmä
Tässä kandidaatintyössä selvennetään metodi rakentaa ja automatisoida pienoismalli nostosilta niin, että siltaa ohjataan ulkoisen tietokoneen (Raspberry Pi) kautta. Tutkimuskysymys on tarkkaan ottaen: Kuinka rakentaa, automatisoida ja ohjata pienoismalli nostosiltaa ulkoisen tietokoneyksikön kautta? Kyseessä on siis laajempi kokonaisuus, joten työssä keskitytään tämän tavan selventämiseen ja muita metodeja ei tutkita laajasti. Lopuksi työssä on myös työn onnistumista pohtiva osio ja arvio siitä mitä tulisi tehdä toisin, jos työ toteutettaisiin uudestaan.
Työ toteutettiin ensin tutkimalla LEGO moottorien ja anturien mahdollisuuksia ja rajoitteita. Sen jälkeen etsittiin erilaisia tapoja yhdistää LEGO SPIKE Prime yksikkö ja Raspberry Pi toisiinsa sekä valitsemalla niistä työhön sopivin. Tätä prosessia on dokumentoitu vähän, sillä vaihtoehdot työhön sopivalla kompleksisuudella olivat rajatut. Sen jälkeen rakennettiin itse pienoismallisilta ottaen huomioon työssä LEGO rakennuspalikoiden sekä anturi ja moottori asettelun tuomat rajoitukset.
Sen jälkeen ohjelmoitiin sillan automatiikka Python ohjelmointikielellä, niin että se pystyttään ajamaan MicroPython alustalla. Automatisointi tehtiin niin, että silta toimisi mahdollisimman itsenäisesti ilman ongelmia. Tämä tarkoitti käytännössä sitä, että ohjaus ohjelmassa keskityttiin sillan avaamiseen ja sulkemiseen oikeilla hetkillä kuvitteellisen liikenteen sujuvoittamiseksi. Haastavimmaksi osuudeksi projektissa muodostui tietokoneyksikön yhdistäminen antureita ja moottoreita ohjaavaan LEGO SPIKE Prime yksikköön, niin että ohjelmakoodia voitaisiin lähettää laitteesta toiseen. Tämä tapahtui Bluetooth yhteyden kautta, jonka avulla päästiin käsiksi SPIKE Primen MicroPython konsolin, jonne komentoja voitiin syöttää.
Työssä päädyttiin lopulta onnistuneeseen tulokseen, vaikka siinä käytetyt metodit eivät lopulta olleetkaan parhaita mahdollisia. Lopputulos kuitenkin vastasi suurinta osaa odotuksista. Tätä metodia vastaavan projektin toistamisessa tulisi kuitenkin harkita eri lähestymistapoja sillan rakentamisen, komponenttien sekä koodin siirtämisen suhteen. This batchelor’s thesis is about a project on building and automating a model draw bridge in a way that it can be controlled via an external computer unit (Raspberry Pi). The more precise research question is: How to build, automate and control a model draw bridge via an external computer unit? The research question is a large topic, but the thesis will cover mostly only one method of completing the project. Other methods and options will be mentioned when appropriate but providing a list of all the possible ways is not the purpose of this thesis. In the end of the thesis there will be a section to review the project, the choices made, and what would be made differently if the project would be attempted again.
The project was executed by first looking into the different possibilities and restrictions created by the LEGO motors and sensors. Then different ways to connect LEGO SPIKE Prime unit and Raspberry Pi to each other and choosing the best one. This process of the project has been documented less as the options regarding complexity in this project are limited. Next is described the building process of the model bridge and the limitations that the different LEGO components introduce.
After the bridge has been built, the thesis focuses on the automation and how it was created. The LEGO SPIKE Prime supports MicroPython programming language and so does Raspberry Pi, so Python was used. The main principle for the automation was the consistent and independent functionality of the bridge. The automation focuses on keeping the traffic flowing by opening and closing the bridge. The most challenging part of the project was to find a suitable method of connection between LEGO SPIKE Prime and Raspberry Pi in such a way that program code could be sent form one device to another. Bluetooth proved to be the most reliable option as it connects straight into the MicroPython terminal in SPIKE Prime.
In the end the result of the project was a grade of “mostly successful”. The methods used were clearly not the best they could have been. If the project would be created again should other methods of bridge building, component choices and priorities on code transfer be reconsidered.
Työ toteutettiin ensin tutkimalla LEGO moottorien ja anturien mahdollisuuksia ja rajoitteita. Sen jälkeen etsittiin erilaisia tapoja yhdistää LEGO SPIKE Prime yksikkö ja Raspberry Pi toisiinsa sekä valitsemalla niistä työhön sopivin. Tätä prosessia on dokumentoitu vähän, sillä vaihtoehdot työhön sopivalla kompleksisuudella olivat rajatut. Sen jälkeen rakennettiin itse pienoismallisilta ottaen huomioon työssä LEGO rakennuspalikoiden sekä anturi ja moottori asettelun tuomat rajoitukset.
Sen jälkeen ohjelmoitiin sillan automatiikka Python ohjelmointikielellä, niin että se pystyttään ajamaan MicroPython alustalla. Automatisointi tehtiin niin, että silta toimisi mahdollisimman itsenäisesti ilman ongelmia. Tämä tarkoitti käytännössä sitä, että ohjaus ohjelmassa keskityttiin sillan avaamiseen ja sulkemiseen oikeilla hetkillä kuvitteellisen liikenteen sujuvoittamiseksi. Haastavimmaksi osuudeksi projektissa muodostui tietokoneyksikön yhdistäminen antureita ja moottoreita ohjaavaan LEGO SPIKE Prime yksikköön, niin että ohjelmakoodia voitaisiin lähettää laitteesta toiseen. Tämä tapahtui Bluetooth yhteyden kautta, jonka avulla päästiin käsiksi SPIKE Primen MicroPython konsolin, jonne komentoja voitiin syöttää.
Työssä päädyttiin lopulta onnistuneeseen tulokseen, vaikka siinä käytetyt metodit eivät lopulta olleetkaan parhaita mahdollisia. Lopputulos kuitenkin vastasi suurinta osaa odotuksista. Tätä metodia vastaavan projektin toistamisessa tulisi kuitenkin harkita eri lähestymistapoja sillan rakentamisen, komponenttien sekä koodin siirtämisen suhteen.
The project was executed by first looking into the different possibilities and restrictions created by the LEGO motors and sensors. Then different ways to connect LEGO SPIKE Prime unit and Raspberry Pi to each other and choosing the best one. This process of the project has been documented less as the options regarding complexity in this project are limited. Next is described the building process of the model bridge and the limitations that the different LEGO components introduce.
After the bridge has been built, the thesis focuses on the automation and how it was created. The LEGO SPIKE Prime supports MicroPython programming language and so does Raspberry Pi, so Python was used. The main principle for the automation was the consistent and independent functionality of the bridge. The automation focuses on keeping the traffic flowing by opening and closing the bridge. The most challenging part of the project was to find a suitable method of connection between LEGO SPIKE Prime and Raspberry Pi in such a way that program code could be sent form one device to another. Bluetooth proved to be the most reliable option as it connects straight into the MicroPython terminal in SPIKE Prime.
In the end the result of the project was a grade of “mostly successful”. The methods used were clearly not the best they could have been. If the project would be created again should other methods of bridge building, component choices and priorities on code transfer be reconsidered.
Kokoelmat
- Kandidaatintutkielmat [10267]
