Sunroom Logger Part 4

Mono just works. Hello World was up and running on the first try. Now to read about using the I/O and look at examples for the DHT11 Temperature/humidity sensor.

Raspberry.IO.GeneralPurpose is available via nuget, but the Raspberry.IO.Components project is not. I pulled down a local copy of the repository, created a quick nuspec file (based on the provided nuspec for the GeneralPurpose), and built a nupkg. I also had to turn on the XML Documentation checkbox for Release and Debug configurations in the Build Properties.

I then added a local nuget source in VS pointing to my Github folder, and was able to install Raspberry.IO.Components to my project.

I also downloaded MySQL on my development computer and on the Pi, as well as configuring a new DB on my webhost. I’ve been learning a lot of SQL at work lately, so am trying to apply that here as well. I’ve created three tables (iot_devices, iot_sensors, and iot_sensor_data), all linked together with foreign keys. I also made a stored procedure that can be called to add an entry to iot_sensor_data. What I also want to do is have the local db on the pi replicate data up to the main database when it can, but be able to store locally when there is no internet connection.

 

Installing MySQL on the Pi

  • References: linuxhomenetworking
  • sudo apt-get install mysql-server-5.5 sysv-rc-conf  (installing mysql-server gives you mariadb instead!)
  • sudo sysv-rc-conf mysql on
  • sudo service mysql start
  • sudo mysqladmin -u root password rootpassword
  • sudo mysql -u root -p    (enter rootpassword when prompted)
  • Now at mysql prompt
  • create database engunneeriotdata
  • grant all privileges on databasename.* to mysqluser@”localhost” identified by ‘password’;
  • grant all privileges on databasename.* to mysqluser@”192.168.0.%” identified by ‘password’; (for management from other computer)

Leave a Reply

Your email address will not be published. Required fields are marked *