hooking up arduino nano and xbee

Hi. Before I start, I might be shooting a lot of questions regarding to this topic.

I am now making a lamp which the user can crank up the lever on the controller (like they do for self-powered lamp) and make the lamp light up by pressing the button. For controller I am using rotary encoder to read how much the user has cranked up the lever, led as a visual indicator, and xbee to communicate with the lamp(which also has Arduino). I’ve been doing pretty good with this, and it all worked well when I used Arduino Uno.

Problem is, when I decided to downsize it by using Arduino Nano and PCB board, it doesn’t seem to work. First when I connected 9V battery to it the LED just lit up by itself(when its initial state is supposed to be off), looking as if too much power has gone through Arduino Nano. I fiddled with it by wiring 9V battery to different holes, but all seemed to have either too much or too little power going through Arduino.

Then I came back to my original wiring, plugged the USB and tried to debug the code on my own, and now the sketch won’t upload on my Arduino Nano. Of course, I plugged Xbee’s TX and RX pin out of Arduino, but on my computer it keeps showing this message:

avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x96

(the value behind “0x” constantly changes)

For my Arduino Nano I’m using the Chinese version. Yes, the one with CH340 chip. Yet the problem doesn’t have to do with CH340 driver, as the uploading previously worked well.

So here goes my question:

  1. Given that this circuit worked well on Arduino Uno, I think this mainly has to do with powering issues with Arduino Nano and 9V battery. How would I have to wire this on my PCB so that 9V battery powers my Arduino and other parts such as Xbee and LED?

  2. For the connection between my CH340 Arduino Nano and computer, it used to work well. However this connection doesn’t seem to work all of a sudden, printing out random error number on the Arduino program(e.g. first it says “not in sync: resp=0xbc” and next it says "not in sync: resp=0x96). What does it mean when the number behind “resp” keeps changing?

Attached is the circuit diagram for controller that I’m talking about. It might be quite confusing.

ghjung:
Attached is the circuit diagram for controller that I'm talking about. It might be quite confusing.

It is confusing, so why not post a circuit diagram that is easy to understand, you might get more help if you do?

Perhaps draw it on paper with a pen or pencil, take a picture, and post that instead ?

The 9V battery must be connected to the regulator input (VIN?) of the Nano. Most probably you killed the Nano already by trying other pins.

The Nano voltage regulator may not be powerful enough to also power the XBEE. A 9V battery is a bad choice for powering Arduinos and other modules, you'll have to replace the battery after a few hours (or XBEE: minutes) of operation.