How to fix Error 516: Unable to Write: Broken Pipe

I'm working on a robotic arm project. But I want to try to connect one of the servo on the robotic arm via bluetooth HC-05. I found the method at https://www.instructables.com/Arduino-How-to-Control-Servo-Motor-Via-Bluetooth-w/

I've made an application at MIT according to the web. However, when I connect bluetooth via MIT App Inventor 2 on my android, I always get the message "Error 516: Unable to Write: Broken pipe". How to fix it? Please help me :frowning_face:

Is there something wrong with the blocks?

fyi. I have tried from several sources that say that the error can be fixed by connect, disconnect, and then reconnect the bluetooth in the application. But, it doesn't work for me :frowning_face:

yes... the clock compnent does not make sense, see also

are you able to connect after starting the app?
which device and Android version are you using for your tests?

Taifun


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by icon24 Taifun.

Hi, thanks for replying me.
Yes, I'm able to connect bluetooth with the MIT AI2 Companion application on my android after starting the app. But it kept saying "Error 516: Unable to write: Broken pipe".

My android type is Android 10. Is android type affect the error?

I've tried the block. But, I still don't get it. Is there something wrong with my block?


Consider the possibility that the slider position changed event happens too fast and too frequently for BlueTooth to keep up.

You can slow down the impact on the BlueTooth component by adding 2 global variables, slider_old and slider_new, both init 0, and a Slider_Clock with Timer event every second.

When slide changed
  set global slider_new to slider.Button position

When Slider_clock.Timer
  if global slider_new not equal slider_old then
     set slider_old to slider_new
     go do your BlueTooth thing.
   end if

Hey,

Just reviving this to provide another possible solution to this particular problem. I just encountered this same issue. I was prototyping a project with an arduino and micro servo on a breadboard with an HC-05.

I followed some bluetooth tutorials for blinking an LED, everything worked fine. Then decided to make a slider element to send a value to turn a servo, and suddenly i keep getting a disconnect from the HC-05 (i can see the blink pattern change) and the pipe error when I try to send another command.

I couldn't really figure this out and spent a lot of time dissecting the code. It turns out, my error was in the electronics. In my haste to prototype an HC05/arduino/servo/AI2 pipeline, I didn't provide a more robust power source for the servo than simply hooking it up to the arduino's 5V out. The starting current of the servo springing to action would dip the voltage and reset the HC-05. By adding a separate, dedicated power source for the servo (connect up all the 0V/ground lines when you do this), suddenly everything started to work as expected, no more broken pipe errors (i.e. no more HC-05 resets).

Just throwing this out there for the next person with a slider/servo issue.

2 Likes

It works for me. The power support is not enough.

hello sir, my question was I am doing the connectivity of Bluetooth by using list picker.
and for connected or not connected I put label - But the if automatically Bluetooth module supply is off then without using disconnect button I have to set automatically label as disconnected how I was do that?

My man blake, I just want to thank you for the most excellent hack you have just helped me to get my bachelor's degree.
keep it up .

1 Like