Rapid prototyping for music, art and design work

N9 connected to Arduino

I am experimenting N9 and Arduino. Since QML on N9 doesn’t support any serial communication over USB, I am using the serial communication over Bluetooth.

This post describes how you control a servo motor with N9 over Bluetooth.


Personal Fabrication

Setting up environment

  • Install Xcode (4GB).
  • Install Qt SDK (1.2GB).
  • Activate developer mode on N9 (Settings > Security > Developer mode). This may take some time to complete.
  • Settings on Qt Creator
      • Go to File > Preference
      • Click Linux devices section
      • Click “Add” to select Device with MADDE support
      • Give a name to the name to identiy this configuration. e.g MyN9
      • Press “No” in the next dialog. They ask if you have a pass word already.
      • Check Create key and press continue
      • Click Create key in the next dialog and press continue
    • N9
      • Connect N9 and your PC with USB and select SDK mode if dialog appears
    • Mac OSX
      • You will be asked to open Network window in System Preference on your PC and press apply to add the N9
    • N9
      • Launch SDK connection app and select USB on the N9
      • You can find password on your screen
    • Qt Creator
      • Go back to Qt Creator preference
      • Type the password into the dialog on Qt Creator preference and press deploy key
      • Select “MeeGo 1.2 Harmattan” in configuration pull down menu
      • Select Key in Authorization type. Your PC will remember password that SDK connection app on N9
      • Close all preference windows on the Qt Creator
  • Install Arduino Software
  • Install USB driver (it should be in the Arduino Software installation package)

First QML application on N9

  • Create a project (File > New file or project)
  • Select Qt Quick Application in Qt Quick project section
  • Give a name to the project and press continue
  • Select Qt Quick Components for Meego/Harmattan and select continue
  • Select only Harmattan for the target setup and select continue
  • You can choose your own app icon and press continue
  • Keep version control as none and press done
  • Qt Creator generates files and press yes in the dialog
  • Run the code (Build > Run)
  • N9 launches your Hello World application after while

Understanding electronics (pdf)

  • Tools: Arduino, Breadboard, Jumper wires and Multimeter
  • Understanding schematics
  • Flow of positive charge
  • Assembling electronics

First Arduino project

    • Connect Arduino to the PC using USB cable
    • Open this PDE file with Arduino Software
    • Select a right Arduino board: Arduino Duemilanove or Nano w/ ATmega328 (Arduino software > Tools > Board)
    • Select a right serial port: /dev/tty/usb****** (Arduino Software > Tools > Serial Port)
    • Upload the PDE file to Arduino (Arduino Software > File > Upload to I/O board)
    • The software shows “Done uploading”.
    • The LED should be flashing.
    • You can modify number in the following line.
  • delay(1000);
  • Upload the code once more to see the result in action.

Control motor from N9 over Bluetooth

Note: N9 should also support USB connection using QML. Android has already a good support on this: Android Open Accessory Development Kit

  • Arduino Software
    • Assemble electronics (pdf)
    • Upload PDE file to Arduino
  • N9
    • Launch SDK connection and select USB
    • Turn Bluetooth on (N9 > Setting application > Bluetooth)
  • Qt Creator
      • Replace MainPage.qml with this code in the previous QML application project. The file is located under the following file name. (Project name) > QML > qml/(project name)
      • In the MainPage.qml, put the physical address of your Bluetooth module as follows. It is written on your Bluetooth module (e.g. 00066602d4cd)
  • property String btAddress: “00:06:66:02:d4:cd”
    • Run the code (Build > Run)
  • N9
    • N9 will launch your application
    • Make sure Bluetooth is activated in Setting application
    • Switch on your application
    • Rotate the N9 device
  • Servo motor
    • The servo motor will rotate as you turn the device!
Facebook Twitter Email

Category: Course materials


5 Responses

  1. Balog Ferenc says:


    I’d like create it with Nokia N8 . What’s that , what I change in QT code or what are another settings ?

    please send mail

    (Sorry for my bad english)

  2. michihito says:

    I don’t have N8 with me so I can’t test anything. You can try to replace MeeGo QtQuick with Symbian QtQuick as follows:

    import 1.1 > import 1.1

  3. Diego says:


    Thank you very much for this post, this make me understand a lot of things about the communication in the N9 and the arduino!

    thank you again!


  4. Peter says:

    did you encounter problems while parsing the data sent from n9 to ardu ?

    I’m sending a long string => “$PHOTO,1,1,123,100” with the bluesocket.sendstringData() function. When i’m connected to my laptop, the string is received properly with one weird extra character in beginning of the string. Also my dsPic can send nicely the same string to laptop but in this case without any weird characters.

    Would you like to test to send a sting “$PHOTO,” and make ardu light a led or similar when the correct string arrives an let me know if you get it working.

    When sending from N9 to dsPIC there is no match. Maybe the QT quick components is not sending proper strings or similar since when i did this with symbian, it worked. At that point i was using bluetoothzero library, not the quick components…

    But if you want to test this i would be pleased 🙂

  5. Madeline says:

    Hey I know this is off topic but I was wondering if you knew of any widgets I could add to my blog that automatically tweet my newest twitter updates.
    I’ve been looking for a plug-in like this for quite some time and was hoping maybe you would have some experience with something like this. Please let me know if you run into anything. I truly enjoy reading your blog and I look forward to your new updates.

Social links powered by Ecreative Internet Marketing