In my project i'm aiming to control a quadruped robot from my android phone using raspberry pi as a middle device (web server). In order to make sure that the server on RPi working fine i googled and got an app that sends a specific character whenever a button is clicked and the arduino job here is simply to receive it from serial port and blink a led! (so easy huh?) but the problem here is that i noticed that some leds are blinking when i click a button not assigned with them! this can be a disaster if you are controlling a robot! Does anybody know the reason of this and the solution?
If I had to guess, I'd say mismatch on baud rates, but it's dangerous to guess.
What you need is some old-fashioned debugging!
- Bug in the app code
- Bug in the arduino code
- Problem with the interface/configuration
First things first, get a serial cable and connect it to a terminal program (Window's HyperTerminal or Unix's screen). First, test your serial cable by itself.Connect the TX to the RX (do a hardware loopback) and type a few characters and watch them appear in the terminal. Remove the loopback, type the characters and watch them fail to appear. This step is critical and has saved me several headaches.
Now, connect your app to the computer, and send some characters and make sure they appear on your terminal. This will test 1.
If that works, disconnect your serial cable from the app and connect it to the arduino. Type the characters and watch them appear. This will test 2.
If both tests pass, this indicates that it might be issue 3. At this point, it could be something such as improper grounding, slight differences in baudrate, loose connection (happens frequently, even to experts.)
Anyways, you need to narrow down the issue before proceeding. Good luck!