4

TL;DR: Multiple Arduinos listening to a single serial rail are burning out my HC-05's TX pin. Arduinos are leaking voltage onto the signal rail. How do I stop, or isolate that to keep from burning out Bluetooth TX pin?

I'm trying to build an LED-based track light that uses an HC-05 to communicate with up to 8 Arduinos to control up to 16 LEDs total. Each Arduino can only control 2 LEDs because of the shape and form factor of the project.

The track has 3 rails, 12V, Ground and Signal and all Arduinos share the same rails. Hopefully the schematic below does a good job explaining it.

Arduinos all share common ground, 12v and data line

On to my issue. Initially, I was getting almost 5V from my pin 7 (SoftwareSerial pin) on the Arduinos, which was quietly ruining the TX pin on my HC-05. I lowered that to about 1v after using pinMode(bluetoothTx, INPUT);, which is good but not good enough. That voltage starts to add up as I add more and more Arduinos to the overall setup.

My solution in theory is to add diodes to pin 7 on the Arduinos, so they can't put voltage on the signal rail. This drops the voltage by 0.7v from what I've read, which most likely is why the Arduinos aren't reading a signal now, because that drops it below the logic level required, since the HC-05 is only putting out 3v3. So I think to add a level shifter on the HC-05 to pump up the signal to 5v, then the diode's voltage drop shouldn't matter right? See schematic below.

Diode's keep pins from leaking voltage onto line, level shifter compensates for voltage drop over diode

My solution seems unnecessarily convoluted and I don't even know if it would work. The more I read without bouncing the information off of others, the more confused I am becoming. Now after reformatting this post for an hour, I am thinking about a decoupling capacitor between the pin and ground... Will that have the effect I am looking for?

I also looked into using a pulldown resistor, but from everything I've seen (and from the first electronics course I've taken), it seems like an inappropriate solution. The examples I've seen usually use a switch, which makes sense, but for my application I am protecting the TX pin on my HC-05, so I think it would not give the effect I am looking for (tapping the line in between resistor and pin would not isolate the voltage, tapping in after the resistor would short the signal to ground).

I'm including my code for completeness, but the schematic is where I think I need help. Could someone point me in the right direction, I don't mind working for my answers but I've been going solo at this for over a month now, and I'm not even at the point in my education where we've covered much logic yet. I'm reaching a little here.

#include <EEPROM.h>
#include <SoftwareSerial.h>

byte address = 1; //change this to change light address
byte lightno = (address + 1); // variable to print light number
int addressShifter= ((address)*500); //This number will be subtracted from input
int bluetoothTx = 7; //btTX to pin 7 //input from HC-05
int bluetoothRx = 8; //btRX to pin 8 //not used
int led1 = 3; // the PWM pin LED1 is attached to
int led2 = 5; // the PWM pin LED2 is attached to
int brightness1 = EEPROM.read(0); //Recalling previous setting
int brightness2 = EEPROM.read(1); //Recalling previous setting
int thismodMin = (0 + addressShifter); //min two-byte looked for
int thismodMax = (499 + addressShifter); //max two-byte looked for

SoftwareSerial bluetooth(bluetoothTx, bluetoothRx); //naming it bluetooth and assigning it to the variables shown

void setup() {
    pinMode(led1, OUTPUT); // sets the pin as output
    pinMode(led2, OUTPUT); // sets the pin as output
    pinMode(bluetoothTx, INPUT); // sets the pin as input
    //Setup usb serial connection to computer
    Serial.begin(9600);
    //Setup Bluetooth serial connection to android
    bluetooth.begin(9600);
    analogWrite(led1, brightness1); //Set Led brightness from stored values
    analogWrite(led2, brightness2); //Set Led brightness from stored values
    Serial.println("SETUP COMPLETE, I am Light #"); //Identify self
    Serial.println(lightno);
    Serial.println("expecting Min "); //Min value listened for
    Serial.println(thismodMin);
    Serial.println("expecting Max "); //Max value listened for
    Serial.println(thismodMax);
}

void loop() {
    //---------Serial Communication---------
    if(bluetooth.available()>= 2) {
        unsigned int blu1 = bluetooth.read();
        unsigned int blu2 = bluetooth.read();
        unsigned int blueinput = (blu2 *256) + blu1;
        //I don't know why any of the above is neccesary but it will not read correctly without this conversion
        //Serial.println("blueinput = "); Not used
        //Serial.println(blueinput);  Not used
        if (((blueinput) >= (thismodMin)) && ((blueinput) < (thismodMax))){
            //If this blueinput is within this modules adress range, convert signal to PWM
            int thisMod = ((blueinput) - (addressShifter));
            //Convert blueinput to a value this module will work with (0-500)
            //-----------Lights---------
            if (((thisMod) >= 0) && ((thisMod) < 100)){ //0=off 1-100=on-Bright
                brightness1 = ((thisMod)*2.55); //converts percentage brightness to PWM value
                analogWrite(led1, brightness1); //apply brightness
                //      Serial.println("brightness1: "); //diagnostics
                //      Serial.println(brightness1); //diagnostics
                delay(10);
            } else if (((thisMod) >= 101) && ((thisMod) < 201)){ //101=off 102-201=on-Bright
                brightness2 = (((thisMod)-101)*2.55); //subtract starting value and then convert percentage brightness to PWM value
                analogWrite(led2, brightness2); //apply brightness
                //      Serial.println("brightness2: "); //diagnostics
                //      Serial.println(brightness2); //diagnostics
                delay(10);
            } else if ((thisMod) == (399)){ //if specific code recieved
                EEPROM.write(0, brightness1); //store brightness setting for light 1
                Serial.println("Epprom1 written");
            } else if ((thisMod) == (424)){
                EEPROM.write(1, brightness2); //store brightness setting for light 2
                Serial.println("Epprom2 written");
            } else{}
        }
    }
}
  • Have you considered that it's not the voltage on the lines, but rather the current that the TX pin is sourcing when connected to multiple Arduinos in parallel that is burning out the pin? – Harper Shelby Feb 28 '17 at 21:51
2

first of all just to clarify some things.

softwareSerial library sets PinMode for rx,tx declared pins internally so it should not have any impact on voltages you measure if you include pinMode(bluetoothTx, INPUT); and if this happens, as you describe, it indicates a problem.

a pin declared as INPUT is on a high impedance state which means that it will not (in general) affect signals connected to it.

an RX pin, by default is pulled up which means that when you do not have anything connected to it, you should measure 5V and when you connect it to GND you should read 0V.


i tried to reproduce your problem by implementing your first schematic utilizing 3 arduinos as receivers with the difference of having another arduino as transmitter instead of HC-05 and using a simplified version of your program (see it below). I could not reproduce it. Also, I suspect that parallel pull up resistors from ~8 arduinos may be the problem, so I would suggest:

  • make sure communication between HC-05 and only one arduino works.
  • try connecting HC-05 with two arduinos and see if both arduinos are able to read incoming data.
  • keep adding arduinos and checking if every arduino can read incoming data.

also try with another arduino as transmitter instead of HC-05 in case you still have a problem and post the results so we can further investigate .

#include <SoftwareSerial.h>


int bluetoothTx = 7;    //btTX to pin 7 //input from HC-05
int bluetoothRx = 8;    //btRX to pin 8 //not used

SoftwareSerial bluetooth(bluetoothTx, bluetoothRx);  //naming it bluetooth and assigning it to the variables shown

void setup()
{
        //Setup usb serial connection to computer
        Serial.begin(9600);

        //Setup Bluetooth serial connection to android
        bluetooth.begin(9600);

        Serial.println("SETUP COMPLETE, I am Light #");  //Identify self
}

void loop()
{
        //---------Serial Communication------
        if(bluetooth.available() )
        {
             Serial.print(bluetooth.read(),HEX );
        }

}
  • Thanks for such a thorough and fast reply, I tested both your code and my own on my uno, mega and nano and all seem to measure 4.5-5v with no load with multimeter (DMM)connected between pin 7 and ground. With a load (2.2k resistor to ground) voltage drops immensely (like a dead batter would with high impedance) so I see what you are saying. With High impedance, the voltage would show but not be there as soon as a load is applied? That said, – Loota Jun 2 '16 at 17:09
  • the voltage without load and with load both drop significantly when I specify pinmode input, can you verify that on your end? If my devices are normal, will this voltage without load hurt my TX pin or is that unrelated? When you say parrallell pull up resistors would that apply to the TX pin that is an input, I assume that the resistor that is giving it high impedance is that same that functions as a pullup, just connected differently? Lastly, if I'm connecting that 2.2k resistor for pin 7 to G, and the voltage drops a ton, I think that takes care of my problem right just using a pulldown? – Loota Jun 2 '16 at 17:27
  • ok, I found an HC-05 and have connected it's TxD pin to 2 uno's , one micro, one mega, all at the same time. Note that on arduino mega, pin 7 cannot operate as softwareSerial RxD pin, so I used it's pin 53 instead. The voltage on the line, when not transmitting any data, is stable to 3.3V as expected, regardless of whether or not pin 7 (or 53 for mega) is explicitly declared as INPUT (with pinMode function). I still suggest you follow the steps provided on this answer and report back on which step problems start appearing. – foivaras Jun 4 '16 at 18:05
  • for the time being, do not concern yourself with pull up resistors think I described.It has a small probability of being the problem source and we must narrow down the problem first. – foivaras Jun 4 '16 at 18:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.