Install your Raspberry PI: connect a screen, a keyboard, a mouse and optionaly a wired network connection
Get the Raspbian image from the official repositoty and flash it to the SD card as er the instructions
Configure it with your local country code, preferred language and keyboard, along with the proper timezone. Set the password for the default 'pi' user to 'raspi'. Optionly, setup your WiFi link if you do not plan to use the wired LAN . Update the software as suggested to get the most recent Raspbian fixes. The system will restart at the end of the upgrade.
Python 3 is installed by default with RaspBian. Click on the small raspberry on the topleft corner, select Programming and then Python. You should see the Python console
Open another terminal and type the following command to create your first script within the text editor: sudo nano hello.py
Add the following lines of code
Type Ctrl-O to save the file and then Ctrl-X to quit the text editor
To test your first script, type python hello.py Note: if you want to start the script directly (without the python prefix), you have to update the file properties. To do so, type: chmod +x hello.py From there, you can start you script by typing ./hello.py
Open a terminal and type the following commands
Open another terminal and type the following command
You should see your message in the other terminal, confirming the MQTT broker is is place and well configured
Now we need to install a library to be able to invoke MQTT services from Python code. The library is named Paho-MQTT and here is how to install it
Here is the code to publish a simple message. Create a Python script, save it and run it. You you see the message popping up in another terminal where a subsciber runs
To install MariaDB, type the following commands
We now have a working database engine but no database yet. Type the following commands within the MariaDB shell
Let's add a user with less power than the root: CREATE USER IF NOT EXISTS gateway@localhost IDENTIFIED BY 'secret';
Let's grant that user the right to access our database: GRANT ALL PRIVILEGES ON FL.* TO 'gateway'@'localhost';
MySQL Connector/Python enables Python programs to access MySQL databases (and therefore MariaDB as well), using an API that is compliant with the Python Database API Specification v2.0 (PEP 249). It is written in pure Python and does not have any dependencies except for the Python Standard Library. To install it, open a terminal amd type : sudo python -m pip install mysql-connector-python
Let'S test it now. Create a new Python script with the following content
Save it and run it. You should not get any error
On Linux the BlueZ library is necessary to access your built-in Bluetooth controller or Bluetooth USB dongle. The most up-to-date version of Raspbian we installed contains a recetn version of BlueZ and there is therfore nothing to do. Note: to check the version , just type bluetoothd --version in a terminal. My version was 5.43
The next step is to validate your HW. Just type the following commands:
Now we need a library to be able to invoke BlueZ services from Python code. Here is how to install it
Let's create a scipt file named discover.py and add the following lines of code
Note: if you have more than one BLE adapter, check with "hcitool dev" command which one you want to use and what is its ID (hci0, hci1, ..), then update your script accordingly. Run it using the sudo python3 discover.py command. You should see a list of discovered devices
Node.js is an open-source, cross-platform JavaScript run-time environment that executes JavaScript code outside of a browser. Node.js lets developers use JavaScript to write command line tools and for server-side scripting—running scripts server-side to produce dynamic web page content before the page is sent to the user's web browser.
:
I 'm using Ubuntu 18.04, on a multiple boot laptop. It works with a VM as well but there are additionnal challenges when you want to communicate with real HW, depending on your VM host.
I'm using Eclipse IDE and some extensions
Download it from the official repo to your laptop
Then run install.sh in a terminal
Finally, run the following commands to allow your user to use the serial port and to program the board:
There is nothing wrong in designing a database schema using a simple text editor but there are more advanced tool. I'm using DBeaver. You can get it from here
By default, MySQL or MariaDB only listens for connections from the localhost. All remote access to the server is denied by default. To enable remote access, run the commands below to open MySQL/MariaDB configuration file.
Just edit the file by typing this command : sudo nano /etc/mysql/mariadb.conf.d/50-server.cnf and set the bind-address to 0.0.0.0. Then restart the service by typing: sudo systemctl restart mariadb.service
To allow a specific client to access the database, there are two additionnal commands to run (from mysql tool with a root account on the Raspberry)
From the remote laptop, connect to your Raspberry..
Here is how a basic database schema would look like:
Using Eclipse remote extension tools, I can do a lot of things but sometimes it is easier to transfer files just between folders on different computers. I'm using Filezilla client on the laptop and SFTPD on the Raspeberry
Depending on your laptop specification, you may need an external dongle (or not..). Here is a way to figure out if you have (or not) the required HW on bord
I'm using Adafruit BLE dongle to see in details the messages exchanged over the air over BLE
I'm using the SKB360_EVB. One of the biggest advantage is the fact that you can easily swap BLE modules without a heat gun
To get full explanations and detailed instructions, see this site. In a nutshell, the idea is to install "node" (and "curl" as part of its dependencies), "nave" (a tool we use to swap between node versions), "yarn" (a packet manager), "angular cli"
Let's create our first Demo Angular project
To create your own app, follow this tutorial. The main steps are the followings: