Monday, February 22, 2016

New book: MySQL for the Internet of Things

Are you building an IOT solution and want to know how to store and retrieve your IOT data? Perhaps you're new to database systems and want to learn how to use them while you explore the exciting world of IOT.

This book is the answer for both scenarios; whether you're new to IOT and want to know how to leverage MySQL in your solution or you've wanted to learn more about MySQL, this book will provide many of the answers you seek.

The book also covers how to design your IOT solution around your data. Not only will you learn more about MySQL, but you will also see how best to deploy MySQL in your IOT solution using low-cost computer boards such as the Raspberry Pi, Beaglebone Black, Intel Galileo, and more.

Finally, the book will give you a thorough overview of how data can be augmented and annotated to make it easier to glean the golden nuggets of knowledge you seek while wading through your sensor data.



You can find my book at most online book sellers or directly from Apress.


26 comments:

  1. Replies
    1. Thanks, I was shooting for nice. :P

      Delete
  2. Congratulations with your new book Chuck!

    ReplyDelete
  3. Looks Great Chuck! Congratulations with this book. I would definitely want to read this :-)

    ReplyDelete
  4. Looks interesting., Congrats Chuck!

    ReplyDelete
  5. I always failed when I tried your tutorial chuck. :(

    ReplyDelete
    Replies
    1. Hi. Sorry you're having trouble. I'd be happy to help you, but I'm going to need more information.

      Which tutorial? What went wrong? Was there an error message? What version of MySQL are you using? Etc. etc.

      Delete
  6. Hi Chuck. Is there a way to use your library to work with the ESP8266WiFi.h library instead of the WiFi.h lib?
    bruce

    ReplyDelete
  7. I bought this book a few weeks ago and working through it.
    All good stuff until ...
    chptr6 when setting up the Arduino to communicate with the database on the RPi.
    On windows the routine: Sketch->Include Library->Manage Libraries Brings up the Libraries manager window to select the relevant MqSQL* files.
    On the RPi this path does not exist/;
    Sketch->Import Library->Add Library does not bring up the Libraries Manager window.
    I downloaded the zip file instead, unzipped it and placed the files in the "Libraries" file in the Arduino directory on the RPi. This eventually worked and now seems to compile. So now I have the program compiling on the PC and the Pi.

    1. To run on the PC, where do I place the ino and sql files?

    2. Run time (upload) on the Pi gives a processing.app.SerialNotFoundException: Serial port /devttyACM0 not found
    refers to tools-> serial port menu, which is of little help to me.

    help?
    tia
    cimh

    ReplyDelete
  8. I have not run the Arduino IDE on the RasPi. In general, libraries are placed in the user's Arduino/Libraries folder. Find out where that is and copy the downloaded MySQL Connector Arduino from git into that folder. This is what the library manager does for you.

    Since you are not seeing the library manager on your RasPi, I wonder if you are using the latest version of the IDE? Check it and make sure you're using the very latest.

    On the PC (Mac, etc.) it's the same - find the Arduino/Libraries folder and copy the connector there.

    I don't know why you're getting an error running your sketch on the RasPi. The reference to the serial port is in the Arduino IDE when you are connecting to an Arduino board. Are you sure you're using the IDE to compile and run? Check your settings. Otherwise, I don't know what the reference is.

    Also, what do you mean by sql files? Do you mean files with a .sql file name extension? Or are you referring to the MySQL Connector Arduino files and if so, in what context?

    Feel free to email me directly if you need more, detailed help.

    d r c h a r l e s b e l l at g m a i l dot c o m

    ReplyDelete
  9. Thank you for your prompt reply! :-)

    I responded, but it seems to have gone awry...

    As I said I did download the salient files to arduino/libraries and unzipped them. After *much* faffing around I have the 'hello_mysql' sketch verifying (compiling) on PC and pi. I'm surprised you've never run the arduino IDE on a RPi ... I thought that was the point? Anyway, I've just bought Beginning Sensor Networks, so perhaps there'll be some more info in there.

    But back to the present. I presume the MAC address and the server address direct the hello_mysql.ino to the mysql server on the PC and the RPi?

    I have used interrupts to follow thru the 'hello mysql' sketch using Serial.print() but it only gets as far as 'Ethernet.begin(mac_addr);' in setup():

    'sudo ifconfig' shows I am using the correct mac address and ip address.

    'USE test_arduino' is enabled ie is open on a terminal.

    ???

    frustrated here

    cimh

    ReplyDelete
    Replies
    1. I will reply with more detail later. For now, here are some hints.

      The point of using the RasPi was to run the MySQL server on it and connect to it via the Arduino (or PC or another RasPi), not to run the Arduino IDE from it (but you can!). Typically, we use our PC to run the Arduino IDE to write and load sketches to our Arduino boards.

      The Mac address must be unique on the network. That is, not the same as another machine on your network. The Mac address is NOT what is used to connect to the server, the IP address is. In your sketch, you need to use the IP address of the MySQL server.

      Please reread those sections and look on the arduino.cc site for more information about networking with the Arduino.

      Again, I will reply with more details later, but I think you've got a few things to sort out first about the basics of using the Arduino IDE and networking in general. I suggest looking at the networking example sketches too for inspiration.

      Delete
    2. Ok, so my hastily written first reply pretty much covers it. But I rephrase it here for more clarity.

      You must choose a mac address that is unique on your network, not the one matching your PC, RasPi, etc.

      You must use the IP address of the MySQL server, not the IP address of your host, PC, etc. Unless, of course, one of those is your MySQL server. ;)

      The Ethernet.begin() method can hang for a number of reasons. Most likely causes include the hardware is not compatible with the Ethernet class, the hardware doesn't work, or you using the wrong mac address, or in your case a DNS server cannot be found on the network.

      My advice is to fix the mac address problem, make sure you're hardware is working correctly, and build, compile, and load your sketch to your arduino from your PC.

      You may want to look at the troubleshooting section in the Connector/Arduino manual too.

      If you are still having problems, send me your sketch and I'll take a look at it. Be sure to include the type of board you're using, the type of networking shield/module, etc.

      Delete
    3. Chuck,

      fwiw the mac address I'm using is for the RPi, as is the arduino ide and the mysql server.

      I'll do what you say and go check everything - and address the other suggestions you make etc.

      PS your "Beginning Sensor Networks..." book arrived this morning. I'm something of a rank noobie here, but I'm minded to get my head round this stuff.

      Thank you very much for your responses, appreciated.

      simh

      Delete
  10. Pretty good post. I just stumbled upon your blog and wanted to say that I have really enjoyed reading your blog posts. Any way I'll be subscribing to your feed and I hope you post again soon. Big thanks for the useful info.
    v

    ReplyDelete
  11. Hello, i'am using the MYSQL Conn for arduino, and i've receiving a BAD MOJO, can you help-me?
    when i try to use SELECT i receive BAD MOJO
    I can use INSERT, but SELECT don't return the data
    print: http://imgur.com/DJcSWv5
    script: https://pastebin.com/mvUHNBur

    Sorry for bad inglish, i'am brazilian

    ReplyDelete
  12. Change your query to:

    SELECT population FROM world.city WHERE name = 'New York'

    If that doesn't work, please tell me what version of MySQL and the connector you are using.

    ReplyDelete
    Replies
    1. Hello, is me again, now i have other problem, when i try to select using a variable i get Error: 158 = You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''%s' at line 1. But the syntax are ok, works in mysql server 5.5, can u help-me?
      Script:https://pastebin.com/WwukKiCV
      TY

      Delete
    2. Please paste the output of the serial monitor so I can see the query.

      Delete
    3. Ok, so you have an issue with the format string. Try this:

      char SELECT_DATA[] = "SELECT acesso FROM test_arduino.autorizacao WHERE ID LIKE '%c%s%c'";
      ...
      sprintf(query, SELECT_DATA, '%', card_id, '%');

      Delete
  13. Now it is working, I was using a 5.0 database created with XAMPP and when I tried to select some data I received a message saying that the database was not selected.
    With MySQL community 5.5 I did it.
    Thanks Dr. Chuck.

    ReplyDelete
  14. Very interesting,good job and thanks for sharing such a good blog.
    Crafsol Connect to all with connectivity and get generate data from the Internet of Things(IoT)
    Internet of Things Solutions

    ReplyDelete