How To Use App Inventor With Arduino

Note: This post is outdated. For a recent version see Getting Started with MIT App Inventor 2 and Arduino.

This project’s source file for the android app is outdated, because it was built using the old MIT APP Inventor Classic software, that is no longer supported. However, this project still works if you convert the files to the recent format here.

We also have other projects that you may find useful:

If you like Android Apps and Arduino take a look at our course: Android Apps for Arduino with MIT App Inventor.

How To Use App Inventor With Arduino

After so many requests, I’ve decided to create this quick tutorial! I hope you enjoy.

This will help you understand how App Inventor works and how it can interact with your arduino via bluetooth.

Watch this video tutorial

Download all my source code below

  • Arduino Sketch
  • BlueLED.apk
  • BlueLED Source files (for editing purpose)

Click here to download

Note: If you want to edit my app this is what you need to do: After you download this folder make sure you unzip it. Only upload the into App Inventor.

Parts Required


You can use the preceding links or go directly to to find all the parts for your projects at the best price!




  • You need to remove the RX and TX cables when you’re uploading the sketch to your Arduino.
  • Sometimes people connect the TX from the bluetooth module to the TX of the Arduino… that’s wrong and it won’t work. Make sure you connect it properly, the TX into RX and the RX into the TX.
  • If the HC-05 Bluetooth Module asks for a password, It’s ’1234′.
  • Before Testing my “BlueLED” app, test if you’ve made all the connections correctly. How you can do that? Simply enter numbers (’1′, ’0′) into your serial monitor and your LED should be turning on and off.

I hope you found this useful!

Do you have any questions? Leave a comment down below!

Thanks for reading. If you like this post probably you might like my next ones, so please support me by subscribing my blog and my Facebook Page.

P.S. You don’t have a Bluetooth Module yet? Read my review here about the one I’m using in this tutorial!

P.P.S. Check a Similar project made by me using MIT App Inventor. (Click here)

Learn how to build a home automation system and we’ll cover the following main subjects: Node-RED, Node-RED Dashboard, Raspberry Pi, ESP32, ESP8266, MQTT, and InfluxDB database DOWNLOAD »
Learn how to build a home automation system and we’ll cover the following main subjects: Node-RED, Node-RED Dashboard, Raspberry Pi, ESP32, ESP8266, MQTT, and InfluxDB database DOWNLOAD »

Recommended Resources

Build a Home Automation System from Scratch » With Raspberry Pi, ESP8266, Arduino, and Node-RED.

Home Automation using ESP8266 eBook and video course » Build IoT and home automation projects.

Arduino Step-by-Step Projects » Build 25 Arduino projects with our course, even with no prior experience!

What to Read Next…

Enjoyed this project? Stay updated by subscribing our newsletter!

72 thoughts on “How To Use App Inventor With Arduino”

  1. Many thanks for the tut! Appreciated
    Could you show by any chance how a led could be dimmed with a slider in the app?

    • Hi,
      thanks for stopping by!
      Right now I have to finish some projects, but that looks like an interesting thing to do.
      But as I said I simply don’t have any time left to do that.
      But if you explore a bit the app you’ll find a way.

      Good luck with your project,
      Rui Santos

  2. Hi,Rui,i am newly to app inventor, how can i open the BlueArd Source files,because i want to edit it and i cant get how to open it in app inventor.please help me…..thank you…..

  3. Hi santos,,i have tried this project and exactly follow the instruction.but,it’s seem didn’t work.i can’t turn on or off the led using my phone. And if i see the dialog in arduino written like this “avrdude: stk500_getsync(): not in sync: resp=0x11”
    What’s mean and what i should do?please help.

    • Please make sure you check all the connections. Follow my exact schematics.

      the dialog in the Arduino, is something that you don’t need to worry about. It always say something similar to that.
      You just need to pay attention if it says. “Upload Complete”.

      Make sure you follow my schematics… and before you try with the bluetooth module send ‘1’ and ‘0’ through the serial monitor.
      If the LED is turnning on and off, the circuit is working!

      Here’s a list of common mistakes while using bluetooth modules:
      – You need to remove the RX and TX cables when you’re uploading the sketch to your Arduino.
      – Sometimes people connect the TX from the bluetooth module to the TX of the Arduino… that’s wrong and it won’t work. Make sure you connect it properly, the TX into RX and the RX into the TX.
      – If the HC-05 Bluetooth Module asks for a password, It’s ’1234′.
      – Before Testing my app, test if you’ve made all the connections properly. How you can do that? Simply enter numbers (’0′, ’1′) into your serial monitor and your LED should be turning on and off

  4. Hi,,Rui.
    i have tried your suggest and result is great.i have little modify with 5 led,in this case on and off in each i need command ‘1’ until ’10’. But,,why in command number ’10’ is not working??it’s mean i only can control 4 led. So,,what command that i must write in order to control more than 4 led?thanks for support.

    • Hi dui,
      You can send any number you desire you just need to right the correct code for your code. My code is just an example!
      Remember that the android app use’s Decimal numbers and the Arduino reads chars.
      So for example the android app receive a 48 and the Arduino will read like a ‘0’.

      See the ASCII Table for all the values:

  5. Hi
    i downloaded your project to get an app for bluetooth connection. but i always get the “error 507: unable to connect – is the device turned on?”
    The devices are already paired.
    After googling I found this statement:
    Did you know this problem before? and what is your workaround? I`m surprised that nobody got this problem before I got…
    Please just tell me, you know this bug und your smartphone uses an android version lower than 2.3, as its described in the link I`ve posted or tell me what I`m doing wrong…

    • Hi Marcello,
      that’s a weird error that I wasn’t aware off..

      The bluetooth feature works fine for me…
      My smartphone runs with version 4.01 and it works just fine.
      It’s probably a compatible problem with your smartphone.

      Some of my friends and a lot of people tested my app with version superior to the 2.3 android version with success.
      Some people also sent me some variations of my app.
      So it might be a problem with your smartphone.

      Not sure how yo help you as a lot of people is using this app successfully.

      Have a nice day,

      • Hey Marcello, try turning Secure off , I try this version and I didn’t have this problem, I did and app like this on App inventor 2 and I was having that problem: Error 507. while I was working on the app I turn off and on the arduino(Unplugging) and also restart the bluetooth service in android, then connection Works!, By the way I’m using SAM Note 3.

    • If you watch my video and read this post on the top.
      You’ll see everything you need to know.
      I’m using MIT APP Inventor which is a good way to create android apps with drag and drop…

      If you want to download the source code, simply click the Like or tweet button and the code will unlock…
      Let me know if you have any more questions !

  6. Thanks for the awesome code but I am experiencing a problem even though I followed your directions spot on. Circuit is working correctly (tested 1 and 0), app is connecting to HC-05, but when I press the LED ON button, the led will not turn on. I checked proper ASCII chart numbers and I also did your suggestion where I disconnected the TX/RX cables before upload of the Arduino sketch. Any advice?

    • Thanks for trying my project.
      Seems like you’ve done everything properly… it should be working…
      how did you wire the Bluetooth module?
      RX BT module -> TX Arduino
      TX BT module -> RX Arduino

      Did you wire like that?

  7. I am wondering, I’ve only seen examples of people controlling one LED this way. Is it possible to have several LED’s hooked up and control them using one Bluetooth card? Or is this best left to an ethernet shield?

    • Hi Mike.
      You can control anything you want with a unique bluetooth module.
      You just need to change the android app and the arduino code in order to do that.
      (add more buttons and more if statements)

      This app establish a bluetooth communication with your your arduino.
      when you press one of the buttons. (On or Off)
      It sends a character via serial communication to your arduino.
      You arduino receives that information and It does something.
      So you can control anything you want.

      If you want more help please tell me a bit more about your project..
      Have a nice day,

  8. Hey. i dont not get any option in andriod app inventor to upload source code. the only option i have is import .aia from my computer.

  9. Hey Rui, thanks for the tut, I have a question that I’ve tried to find the answer beforehand, but couldn’t get it. Why 49 and 50 while in android code Its expected ‘1’ and ‘2’??

  10. Hey Rui! I guess your tutorial is clear, however i can’t get it to work.
    I have wired everything like you, I have tried sending serial commands from the PC and it works. I just can’t get it to work with your app.
    I do get a confirmation that the app is connected to the HC-05.

    Do you have any tips on further troubleshooting?


    • Can you try this project with another smartphone?
      It can be a compatible problem or something..
      Are you wiring the bluetooth module properly?
      The TX from the bluetooth goes to the RX of the Arduino.
      The RX from the bluetooth goes to the TX of the Arduino.

      I hope this helps Eirik!

  11. hi rui,
    why my bluetooth module cannot be detected by the app?
    i can’t connet it to my phone.
    the circuit is working perfectly when i enter 0 and 1.
    please help

  12. hi rui,
    why when i want to connect my phone to bluetooth module it says

    Runtime Error
    Need BLUETOOTH_ADMIN permission: Neither user 10130 nor current process has android.permission.BLUETOOTH_ADMIN.

    please help.

    • Do uyou have by any change another smartphone that you can test my app with?
      Which is the android version you’re running?

      • thanks for the reply.

        well i’m using android 4.2.2
        when i use bleuterm app it works perfectly fine but not with blueLED app.
        i try to google it and it comes to something about manifest problem which is something i’m not very familiar with.
        it seems that the app that is downloaded from Play Store that only work.
        do you have any idea how to solve this problem?

        • yeah it should work just fine with my android and it’s also version 4.2.2 at the moment.
          you might need to change some of your bluetooth setting I guess.

          That never happened to me…

          • well then I guess i’ll just figure it out myself..
            thanks anyway.. u made my final year project a lot easier..

          • hi Rui,
            i’m using the app inventor to modify your BlueArd.apk design.
            i’m curious.
            in the block of “BluetoothClient1.Send1ByteNumber”, you use number 49, 50, 51 to start and stop the motor instead of using number 1 to start and number 0 to stop.
            can you please explain it to me? thanks.

  13. hello ! great tutorial!
    I have a problem where I can’t find a list of device to connect to.

    when i press the choose device to connect to, the screen is just blank and device list does not show up.
    I have tried it with android 4.4.2 and 2.3.7. On both phones, cannot detect devices.
    Any advices? Thank you in advance!

    • That never happened to me Sj,
      I have no idea what might be… can you try with another smartphone?
      Please re-check all the bluetooth setting and make sure everything is properly.

  14. Hi Rui Santos,

    I have problem with multiple screen.. how i want to connected BluetoothClient1.SendBytes in Screen2 and Screen3 with Screen1?? because i have set up BluetoothClient1.connect in Screen1..any idea??


    • Hi,
      that never happened to me, I think that by default MIT App inventor stays connected trough the multiple screens…
      So I’m not sure what the problem might be… Sorry

  15. hello sir,
    i checked out your project and was very eager to build it. so i ordered the bluetooth module and its not HC-05 or 06
    i ordered sparkfun bluesmirf silver
    and from 4 days ive been trying to connect the module with my phone but its not getting connected and ive noticed that none of the people have made projects with bluesmirf and appinventor.
    yes, ive tried to connect the bluetooth module with other apps of android and it gets connected but its not getting connected with the app inventor apps.
    pls help me pls
    i need to submit it as a project in college and i do have 100 marks for it. pls


    • Hi Parth,
      Have you checked the most common mistakes? If not please try again…

      is you project working when you control the LED trough the serial monitor?
      Have you change anything from my app?
      Please first try with the exact .apk file I provided before you change anything.

  16. Hello rui, it work excelent ¡ i test it and now i understand number 49 and 50 for led on and off, but i want programmer with the number 1 and 2 in app inventor so when arduino receiver 1 or 0 make led on or off. have you any suggestion for modification in the code in arduino.?

    • Hi Fabian,
      In the Arduino code you just need to change those if statements to the numbers you want to trigger the LED.
      Those numbers must be the same in the android app…

  17. hello, I need your help, how make an application using appinventor which can send data from arduino to Android app with USB connection (without bluetooth)??

  18. thanx rui for u useful tutorial
    could use plz guide me “MIT APP INVENTOR” code controlle DC motor in 2 directions using accelerometer

  19. Hey! I wonder if anyone can help me with my problem. I am trying to finish this project as my thesis but after a month trying different ways to solve it, I really don’t know what else to do now.

    I am building my app with App inventor 2 and with my arduino. I have a gas sensor which via bluetooth sends the numbers to the app and whenever the value of the gas increases the phone has to give a notification and to speak some text.

    My problem is that I am trying different ways of receiving the value and I can not find the correct way to receive the numbers and then with a math block is needed to compare if that value is higher or lower than another value.

    So I will explain what I have and let’s see if it helps you to understand what I am doing wrong:
    Inside the timer it checks first if the bluetooth is connected, if so, set variable Sensor to Call Bluetooth BytesAvailableToReceive. And if button On is not enabled, set value text to get global Sensor.
    And right after that it comes the comparison, if get global Sensor is higher or equal than 700 then set Color Alarm red, call notification and call VoiceAlert.

    And here I just receive a number 1 on my label value. I have also tried different ways of receiving the value but none of them has worked yet, so if you could please help me to solve this I would really appreciate it.

    Thank you in advance for your help.


  20. hello rui..
    im newbie to make androis app. i follow your tutorial video on youtube. i got some of problem. whats mean error 507 ? it said unable to the device turn on ? . i make it for my final year project and this presentation on end of april. what should i do ? please help me

  21. Hi Rui,
    thx for code..
    I am using 1.6.8 arduino version..
    When I read coming data from serial monitor , I read 128 0 0..I wrote that : Serial.println(state);
    And I also my led is not working..
    And when I push the off button , I read 0 0 0 …What can I do ?

  22. Hi,
    Im trying to do a similar thing like this tutorial.
    I want to turn leds (in one circuit) with the android, but when it turns off (by a sensor) I want to another led (in another circuit, separately) turns on and when it turns off (by a sensor)……. and go like this with 8 circuits.
    How can I do that?


Leave a Comment

Download Our Free eBooks and Resources

Get instant access to our FREE eBooks, Resources, and Exclusive Electronics Projects by entering your email address below.