Chapter 2 Getting Started
Wow content
Move on
2.1 Sensor Dev Env
This Chapter is a short guide for setting up your development environment. Until you receive your hardware you can start with installing the necessary software.
2.1.1 Software Setup
Download “Segger Embedded Studio for ARM 5.10d” (https://www.segger.com/downloads/embedded-studio)
Download nRF5_SDK_15.3.0_59ac345.zip (https://developer.nordicsemi.com/nRF5_SDK/nRF5_SDK_v15.x.x/)
Clone https://github.com/bchwtz-fhswf/ruuvi.firmware.c. Copy the extracted ZIP from 2. Inside the cloned folder (If you don’t know how to clone a git repository look at https://git-scm.com/book/en/v2/Git-Basics-Getting-a-Git-Repository or search on google/youtube) It should look like this:
Open SEGGER and click “File” -> “Open Solution”, navigate to the cloned repository and open “ruuvi.firmware.c”. The project should now be inside SEGGER.
Search “Project ‘ruuvitag_b’” on the left inside SEGGER, right-click and choose “Set as Active Project”.
To pull the current version of all subrepositories, please use
make pull
in any bash-compatible shell.
2.1.2 Alternative Software Setup (building releases)
Install docker (either docker-desktop or on linux your preferred docker package).
If you use Windows or Mac, please set your preferred RAM-size and CPU-Count in the docker-desktop-app.
Run
docker_build.sh
in any bash-compatible environment (e.g. git-bash)
This leaves you with the release-binaries in src/targets/ruuvitag_b/arm_gcc/
.
For further details refer to the README.md
2.1.3 Hardware Setup
- Open your ruuvi tag, take PCB & battery out (you can do so with a little screwdriver or by gently pulling on the battery clip)
Connect the “Tag Connector” cable + plug to your ruuvi tag
Connect the other side of the tag connector to the Debug out slot on the Nordic SDK
Connect your SDK over USB with your PC
Turn on the switch at the bottom left
To test if everything is right, open SEGGER and click “Target”->”Connect J-Link”. SEGGER should connect to your SDK
To flash your ruuvi tag with the cloned firmware, click “Target”->”Erase All”, afterwards click “Build”->”Build and Run”
2.2 Gateway Dev Env
2.2.1 Raspberry connection via screen
Connect your Raspberry Pi to a screen via Micro HDMI if you have an external screen.
Connect your Raspberry to your WiFi
Activate SSH and VNC by clicking on the raspberry on the top left -> Preferences -> Raspberry-Pi-Configuration->Interfaces, change SSH and VNC to activated
Skip next steps and jump directly to number 9!
2.2.2 Raspberry connection without a screen (headless setup)
Documentation follows this video: https://www.youtube.com/watch?v=rGygESilg8w
Take the SD-card of the Raspberry and put it in the card reader of your PC.
Go to https://www.raspberrypi.com/software/ and download the Raspberry Pi OS Imager if not yet installed.
Open Raspberry Pi Imager.
Install operating system and choose the Raspberry Pi OS (normally recommended).
Choose your SD card as storage and click “WRITE”.
2.2.3 Set up PuTTY and finalize connection to Raspberry
On your PC, download PuTTY (https://www.putty.org/)
Get your Raspberry’s IP-Adress by opening a command line on your PC and and type
Open PuTTY, type the IP-Adress into the Host Name field. You can save it by entering a name into the “Saved Sessions” field and pressing “save”. Afterwards select “open”.
When asked for the username type
and afterwards enter your password. If you did not change it on Raspberry’s startup it should be
To clone the Gateway repository (https://github.com/bchwtz-fhswf/gateway) onto your pi, you need a SSH Key which is connected to your account. Generate it by following the instructions in https://docs.github.com/en/github/authenticating-to-github/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent for Linux (you dont have to pass it to a key agent) and add it to your account by following the instructions in https://docs.github.com/en/github/authenticating-to-github/adding-a-new-ssh-key-to-your-github-account
Clone the gateway repository to your raspberry by typing
into the PuTTY window connected to your raspberry. When asked, enter the SSH Key password you initiated while generating the key.
- Before you are able to execute some of the scripts, you have to install some Python modules by typing or pasting the following commands. (You can paste into a PuTTY window by right-clicking)
pip3 install ruuvitag_sensor
pip3 install crcmod
pip3 install pygatt
pip3 install interruptingcow
sudo apt-get install bluez bluez-hcidump
To try if your setup is working, navigate to the cloned repo and type “python3 GetConfigFromSensor.py”. You should see something like this:
To properly use the gateway library, type “python3” into the putty command window. This activates an interactive python session. Type
Afterwards you can type
test=SensorGatewayCommunication.RuuviTagAccelerometerCommunication()
test.activate_logging_at_sensor()
Wait a few seconds and type
Wait 2 minutes and type
You should see some x,y and z acceleration data after executing the get_last_sample_acceleration_data function. After get_acceleration_data, you should see a lot of hex data flooding through your screen. They get saved inside a .csv file for further analysis.
CONGRATULATIONS! YOUR SETUP IS READY!!!