Problems with Arduino to DHB-10 serial connection
![Tarkahn2019](https://forums.parallax.com/uploads/userpics/955/nQM5RBJVOG717.png)
in Robotics
I'm getting no serial connection from Arduino to DHB-10 I've checked all the connections multiple times, I've checked all the voltages and the controller has the latest firmware. Is there something I'm doing wrong here? I've included a youtube video showing the setup. hopefully someone can point out what i'm doing wrong?
![](https://img.youtube.com/vi/9bjshS6J31I/0.jpg)
![](https://img.youtube.com/vi/9bjshS6J31I/0.jpg)
Comments
Jim
From what I could see in the video, it seems you are TX-ing the command to DHB10, but not RX-ing the reply.
The Propeller code transmits and receives on a single pin.
AFAIK with Arduino, the serial routines don't work that way, and you need a separate IO for tx and rx ?
As I recall, DHB10 does support that mode, and you can hook the serial rx with a second servo header connection. Maybe from DHB10 to ch2. There might also be a special command to put DHB10 into that mode. Maybe check the DHB10 user guide with those clues.
If your still stuck Monday I could try taking a better look for you. Hope that helps a bit for now.
Found an older post, where another customer had UNO issues, and I think it turned out to be an internal pull-down resistor setting on the UNO RX-pin which needed to be disabled in the UNO code.
http://forums.parallax.com/discussion/168891/problem-with-dhb-10-and-arduino-shield
I'm just following the Parallax tutorial. There was no mention about making sure the baud rate was consistent between Arduino and the controller.
I did in fact think of that and looked in the controller firmware code and was unable to find any variable that defined what the baud rate should be.
Baud rate from the Parallax given code is 9600 for the Arduino Serial to terminal (typical) and the Serial connection for the controller is set to 19200 within
the Arduino sketch. Again, all code given in the tutorial by Parallax. Does anyone know where the baud rate of the controller is defined within firmware?
Verify that that was the firmware that was used to update.
I was under the impression that the arduino has bi-directional serial. I don't see any other mechanism on the controller board to separately send back serial data to the Arduino. Again, I'm just doing the tutorial exactly as Parallax instructs. These are pretty old instructional tutorials. you'd think Parallax would have updated the tutorial to account for these sorts of problems. I'll investigate the pull up resister possible issue. Using Channel 2 is not an option since that connects to the second motor. I wonder if Parallax has anything to say about this.
The Arduino Sketch in turn executes that library code as follows:
You can see from the code comments that Arduino Pin 12 is receiving from DHB and Pin 13 is transmitting to DHB so there is definitely
a mechanism to receive serial data from the Controller. Unfortunately I don't have a scope to look at Pin 12 and see what's going through there.
As an aside, the red wire on those connections is not connected. I assume no voltage is going through Red, only white signal wire and ground.
One more thing to try, is to using different pins - I'll update if I find out anything new
I'm pretty sure you control both motors through the single serial connection, so based on the expected defaults, you should be able to use the system if you "simply" connect a pair of servo cables, one from dhb10-ch1 and the other from dhb-ch2 to those IO12 and IO13 on the Arduino shield, as defined in the code.
Also, about RED... On the DHB10 the "R"ed pin is not connected to anything. So you can use the 3-way servo cable without any concerns of power confusions! Only "B" ground and "W" signal are actually connected on the DHB10 PCB. It's just handy to use that 3-way servo cable as it's nice and robust.
Edit: Grey cells are turning... I seem to recall that the DHB10 firmware either autodetects the ch2 connection, or sends the serial replies out on ch2 regardless of the connection. Either way, I think you will get the serial replies back from ch2 after Arduino sends the command to ch1.
Edit2: Ah! Think I've realised what you meant about ch2 controlling motor2... In PWM mode, each motor gets controlled by it's own channel, so yes- your right! In serial mode, ch1 is RXD and ch2 is TXD (from DHB10 perspective), and the serial commands control either motor.
I also disconnected middle red wire since those are unusable.
Also, I checked voltage between Pin 12 and ground and got a consistent 3+ volts which might suggest VonSzarvas was right when he suggested
it was related to a pull down resistor setting for Pin12. Does anyone see any problems with my approach to troubleshooting this problem?
Shouldn't Pin 12 show zero volts until there is serial data coming through it?
I think the idle state for a TTL-UART is a high state so it being ~3V isn't completely unexpected if it wasn't actively sending data. If you had an o-scope, you could see if it is sending response data back over Ch2's white wire (D12 on Arduino).
Your setup does look similar to how I wired a DHB-10 to an mbed microcontroller for one of my projects in the past. I haven't looked at the DHB-10 firmware before but I take it that it isn't case sensitive for the commands? The reason I ask is that I used uppercase for commands like TXPIN CH2\r in my code since that was what I saw in the DHB-10 documentation but I saw in one of your snippets above the Arlo object was using lowercase.
Thanks for the reply and the additional grey cell activity! I misspoke on my earlier post when I mentioned that I needed channel 2 for the other motor. This shows just how much I have to learn about what I'm doing here. I realized later that the Channel 1 and 2 on the controller are simply for serial communication. They have nothing to do with the motors directly. I was aware that Red is disconnected on the controller and that Serial only requires two wires; ground and signal (white). So the basic circuitry is understood and confirmed as correct especially now that I've simplified the wiring.
Another thing I misspoke about in an earlier post was when I said I was getting 3+ volts from Pin 12. I meant to say I was getting continuous 3+ volts from controller channel two, NOT arduino pin 12
Pin 12 is set to input and should have no output though I am aware of the possible need for a pulldown resistor on that pin if there is noise in the circuit.
My problem now in testing this is that I don't know how to implement the internal pulldown resistor since this pin is being controlled by the Arduino SoftwareSerial library. I'll continue to experiment with a solution to the pulldown resistor problem (if it even is the problem) until someone has thoughts on how do this.
Yes to your first question robotsRcool! I simplified the wiring now so that I have a direct wire from signal and ground (no red) between arduino pins and controller channels exactly as Parallax instructs. Wiring looks better and rules out bad wiring. regrettable i don't have a scope to check signal on channel 2 and especially Arduino Pin 12 which I'm thinking must be noisy. At this point I'm actively looking to solve the problem of implementing an internal pullup resistor on pin 12 but the problem is I don't know how to do this in the context of the Arduino Software Serial library which is currently how these pins are being defined in code. I'll try retyping the code in upper case. Please note that I have not altered the Arduino code in any way. If it is showing lower case then that is how it was when I downloaded it from Parallax source.
Here is latest clip showing the new simplified wiring.
That would be expected when nothing is connected to ch2, as DHB10 has pullups to 3.3V on each of the signal outs (ch1, ch2, aux1, aux2).
As an experiment, you could try adding two additional 10K pullup resistors... one from ch.1 to 3.3V, and the other from ch.2 to 3.3V.
Might be simplest to do that on the Arduino shield.
That will strengthen the serial pullup, in-case noise was your issue. This serial implementation idles high, so you definitely want pullups, and NOT pulldowns.
If that doesn't fix things, then getting an oscilloscope on the tx and rx lines ( I mean, ch1 and ch2) would probably be the next step. See what's going on !
If you don't have an o'scope, and if you're willing to share the code your using (or a link to the exact steps you followed), I'd be happy to set up an Uno with BOE shield and DHB10 here. I'm short on time this week, but if you make it easy for me to make the test, then I'm happy to try it!
Or try calling Parallax support on Monday, as they may have some other tips !
I believe this is the tutorial being used:
https://learn.parallax.com/tutorials/robot/arlo/arlo-arduino-uno-boe-shield-brain
I wonder if the failure is due to no encoders connected.
I couldn't open the video clip yet to see if you're doing this already, but another thought was to ensure you are sending CR LF after the serial commands ? - Maybe the Arduino code uses \r\n
Just a guess, but maybe DHB10 firmware expects either one or both of the termination chars before it replies ?
The ArloRobot.cpp library does pass a return to the controller with this code
It was suggested that the txpin ch2 should be in uppercase, I tried this and got the same result. \r is an abstraction. Curious to know if an ASCII or Unicode character can be passed instead. Seems like a stretch considering this Arduino code is lifted directly from the Parallax tutorial. In anycase, I'm still considering a pullup resistor option to test. Seeing as I can't figure out how to do this in software with Arduino's 20k internal resistor, I may need to experiment with an external resistor on the breadboard. I'll need some time to think that option through before posting results. I'll also be calling Parallax on Monday to get their take on this. If I learn anything new I'll post results next week. Thx for everyones help so far!
It was mentioned that a pull-down resistor on the Arduino's D12 signal could cause problems and from looking at the DHB-10 schematic I do see how that could result in an issue BUT I would also expect you to see a voltage much less than 3.3V on D12 when it is idling if that was the case.
Could it be something funky with your Arduino board? Is it a genuine Arduino? Which model is it? I can't see it under the shield in the video.
Have you tried removing the two ground wires between the servo connectors and just connecting the signal wires instead (I see that you have already removed the power wires as they weren't needed either)? The reason I suggest this is that the 2 boards already share a ground via the battery and having those ground wires connected too could create a ground loop which I have had cause weird issues when working with motor controllers in the past.
Your setup looks so correct to me that it must be some simple little thing that is off and causing your issues. I hope that your call to Parallax can quickly resolve your issue so that you can start the fun of robot code writing.
Good luck!
Times like this I wish I had easy access to a scope. I have my own lab at home now, I regret cancelling my local makerspace subscription, they have plenty of scopes there....grrrr
UPDATE: I took off the board of education shield and wired directly from Arduino pins to the DHB-10 - no luck getting proper serial output. I also tried different pins including 10 and 11 as well as 0 and 1 which are actually labeled TX for pin 1 and RX for pin 0. Same result.
Every instinct i have tells me there is a problem with the controller though as I mentioned in an earlier post I was able to move the motors using standard PWM.
It does kind of sound like that.
I did notice that the SoftwareSerial documentation mentions a few limitations on pins and speeds depending on the model of Arduino that you are using. For example if you were using the Leonardo then D12 wouldn't work as the Rx pin.
Amazingly, while I am still getting zero returned for firmware, I AM getting a 1 on the hardware inquiry passed back to the Arduino though not consistently - i'd say about 30% of the time. I'm supposed to be getting a result of 10 for fwver and 1 for hwver. oh well, close, but no cigar
fwver = 0
hwver = 1
fwver = 0
hwver = 0
fwver = 0
hwver = 0
fwver = 0
hwver = 0
fwver = 0
hwver = 0
fwver = 0
hwver = 1
fwver = 0
hwver = 1
fwver = 0
hwver = 0
Have you tried just sending a writeMotorPower(64, 64) command to the Arlo object with motors attached to see if the DHB-10 is receiving serial commands from the Arduino but just encountering issues on getting response data back to the Arduino?
I'm using a genuine Arduino Uno V3 - i was originally using the parallax Board of Education Shield with the Arduino but as a test I took it off and wired directly from Arduino Pin 12 and 13 rather than through the shield, just to rule out problems with the shield. I haven't had time to try @robotsRcool suggestion to test to see if controller is receiving (separately from controller sending). That's a great idea, I don't know why I didn't think to try that. I woin't have time until tomorrow to try it but I'll post results. Thx @robotsRcool
I have experienced the same communication issue that you have between either my Arduino Uno R3 or 2560 Mega R3 and the Parallax DHB-10.
I have followed the Troubleshooting Your Arlo + BOE Shield Guide
Both the Uno and the Meg transmit successfully to the DHB-10 and receive successfully from the DHB-10. However both the firmware and hardware responses are definitely received, but are garbled.
I get the following response:
fwver = 0
VER\r \r
hwver = 1
HWVER\r 1\r
The fwver = 0 response is obviously wrong, however the hwver =1 is correct.
Changing the Arduino program code to request both the firmware version and the hardware version twice in a row definitely improved the receive function and I could somewhat tell that the firmware version is 10 and hardware version is 1.
I definitely believe that the Propeller cannot pull down the Arduino Uno/Mega pin 12 input (which has around a 20k pull up resistor) to 0 volts sufficiently for reliable communication. Looking at the DHB-10 schematic it can be seen that besides the 10k resistor that is in series between the Propeller Tx line and the Serial 2 pin 3 on the DHB-10 there is also a 100k pull up resistor connected to 3.3vdc on the Serial 2 pin 3 side of the 10k series resistor. Therefore the Propeller Tx pin has to pull down to 0 volts through the 10k series resistor against two parallel pull up paths one connected to 5vdc though the pin 12 20k pull up resistor on the Arduino Uno and the 100k pull up resistor on the DHB-10 board.
Therefore I suspect that a level shifter to convert the Propeller serial output from 3.3v to 5v will possibly solve the problem.
I think that it is obvious that the Arduino/DHB-10 combination, due to the issue with not being able to receive data correctly from the DHB-10, is less than optimal compared to using a Propeller Board with the DHB-10 which appears to communicate just fine.
Comments?
Regards,
TCIII
Tarkahn2019 has already tried (see above) what you are suggesting and all it did was give him zeros. Disabling the Arduino pull up does nothing but create noise.
I believe that the only way to improve the Propeller Tx line communicating with the Arduino Uno pin 12 Rx is to buffer it with a level shifter to shift the 0 - 3.3v signal to 0 - 5v. The 10k resistor in series with the Propeller Serial Tx output is definitely not helping the issue as the Serial Tx line tries to pull down the Arduino pin 12 Rx 20k pull up resistor to 0 v.
If Parallax is going to advertise that Propeller based hardware can communicate with the Arduino family of processors, then they need to ensure that the Propeller Tx output can pull down the Rx input on the Arduinos for reliable communication. It does no good to have only one way communication with the DHB-10!
Regards,
TCIII AVD
I sent Parallax Support an email documenting the Propeller to Arduino communication issue as it has evolved in this thread yesterday.
Today I verbally followed up my email with a telephone call to Parallax Tech Support. I reiterated what I had sent in my previous day's email and the support tech indicated that they are aware of the Propeller to Arduino communication issue.
Apparently they are working on a solution, however that will not help those of us who have already purchased a DHB-10.
Hopefully they might come out with instructions on how to insert a level shifter between the Propeller and the Arduinos to insure that the Arduinos will be able to accurately receive Propeller serial communication.
Regards,
TCIII AVD