Having trouble getting remote ADC servo reading thing working

It should be pretty simple. A BT serial module, a servo, and a button. Pretty simple, right? For some reason I can’t get it working, (It being the whole thing).

I got it so that it would send the ADC value, and display it on my controller, but sending NunChuck packets didn’t work. Packet checks out, but it didn’t seem like the remote ATMega328 actually was processing it? Was it a library conflict? I checked the libraries, and there might be a conflict. The software serial library depends on interrupts to function, and if another interrupt is running, it will block them (such as software servo library, or Servo in Arduino). Another thing I realized more, is that the software serial library can only send or receive, it cannot receive while sending.

I tried to eliminate the hardware from the equation. I attempted to hook up the BT Serial modem directly to my USB to TTL adapter… but nada. The bazaar thing was, when I connected the BT serial TX and RX together, it echoed fine (tested by sending chars through BT serial on CPU). Maybe it’s the breadboard?

Moved it to another board, and tried out the BT module by itself. Success. Put in the ATMega with a simple TX/RX serial echo sketch.. Nada. The funny thing is, if I use SW serial on the ATMega, it works! If I send ‘t’, it responds with ‘t’. With ‘test’, it shows ‘tXXX’, where XXX is some random character. This is the limitation of the SW serial library (and my sketch) because I had it receive 1 character, and send it back. When it got the second character, it was still sending the first, so it couldn’t process it. So HW serial doesn’t work, but SW serial does? Maybe its the chip.

I’ve tried reflashing the chip, but it didn’t work…. Till I figured out that I forgot the 16MHz resonator… Doh! I’ll try to get this working tonight, cause I really do enjoy making progress on things…


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s