EEVblog Electronics Community Forum

Electronics => Beginners => Topic started by: NotionalLabs on September 16, 2013, 04:53:06 am

Title: Controller theory question
Post by: NotionalLabs on September 16, 2013, 04:53:06 am
Hey everyone,

I'm learning some electronics basics as a hobby and want to expand my general knowledge of general techniques and design components used in consumer products. I've done some work decoding the IR protocol for the cheap 20-dollar RC helicopters that we've seen a million times, but now I've turned my attention to the way the controller works at a more basic level.

I'm coming unstuck in figuring out exactly how the controls work on the controller for the Syma S107G helicopter:

http://www.jimhung.co.uk/?attachment_id=1238 (http://www.jimhung.co.uk/?attachment_id=1238)

As far as I've been able to tell, each control (Throttle, Trim, Yaw, Pitch) actuates a 5KOhm variable resistor which each share a common negative rail. The +ve side of the resistors are connected to pins 1,12,13, and 14 on the unmarked IC. I drew up a little schematic of this in case it's not clear from the description:

http://www.jimhung.co.uk/?attachment_id=1236 (http://www.jimhung.co.uk/?attachment_id=1236)

I've annotated a photo of the tracks to make it a bit clearer where the components are:

http://www.jimhung.co.uk/?attachment_id=1235 (http://www.jimhung.co.uk/?attachment_id=1235)

Through testing with my multimeter, I've observed that the voltage across the variable resistors is about 50mV at max, and 0v at the lowest.

I'm familiar with the idea that the IC is probably sampling the voltage level using an ADC in order to read the control's position, but I thought that these kinds of circuits are built as voltage dividers (i.e. with a fixed resistor and the power sourced from somewhere other than the sensing pin of the IC).

My knowledge of the basics of electronics is still very rudimentary, so if the answer is obvious then I'd really appreciate you explaining it to me. Is this a common way to design resistance-based sensor inputs? What is the mechanism inside the IC likely to be?

Thanks for reading,

Jim
Title: Re: Controller theory question
Post by: sleemanj on September 16, 2013, 07:23:34 am
I would assume if your diagram is right that the analog inputs have a pullup activated internally in the IC, so imagine a high value resistor connected from the pin to (lets say) VCC.

Now imagine what happens when the wiper is moved, you can see that the pin is pulled closer or further from ground.

By connecting the wiper to one end like that, the pot is basically now just a variable resistor. 

So you can see that it is a voltage divider, the upper half of the divider is the (internal) pullup, the lower half of the divider is the pot as a variable resistor.
Title: Re: Controller theory question
Post by: NotionalLabs on September 18, 2013, 02:59:11 pm
Ah - that makes a lot of sense now I think about it!

So in general, I'm assuming you would see this kind of design in purpose built IC's (or ones at least generally aimed at a specific niche), but those which use more general purpose parts would have the voltage divider on the outside?

Do you know if Arduino (Uno, lets say) Analogue pins pulled up this way?

Thanks for the reply,

Jim
Title: Re: Controller theory question
Post by: SeanB on September 18, 2013, 06:26:12 pm
A lot of MCU's have pull up rersistors that are part of the chip. They can be either strong or weak, really a function of the resistance they are, typically around 1-10k or 100k-1M. They will be very poor both voltage wise and vary with both supply voltage and input voltage in most cases but they generally are designed as digital pull up devices.

If you want to use them purposely as analogue inputs on a purpose designed chip then it is simple to build in a constant current source in the chip to provide better repeatability between units. No extra cost other than a slightly larger area of silicon used which might be free anyway to fit in a certain chip size.
Title: Re: Controller theory question
Post by: AG6QR on September 18, 2013, 09:19:03 pm
Do you know if Arduino (Uno, lets say) Analogue pins pulled up this way?

The details might vary with different flavors of Arduino, but it generally has pullup resistors on its analog inputs.  They may be turned on or off, under control of the software.

http://arduino.cc/en/Tutorial/AnalogInputPins (http://arduino.cc/en/Tutorial/AnalogInputPins)
Title: Re: Controller theory question
Post by: NotionalLabs on September 20, 2013, 12:39:51 am
Ahh, I think this is clicking for me now - thanks for the responses!

So from your link and the Arduino reference guide, it appears that they have 20k internal pull up resistors that can be enabled in software (like you mentioned) - if I wanted to build a replacement controller using the same hardware as the helicopter controller (5k pots all-round, for instance) and an Arduino Uno, am I correct in thinking the calculation for the Voltage Divider would be as follows?

5V * (5k/20k+5k) = 1V (max) and 0V (min)
*lets assume a 5v Vcc instead of the ~9v that the controller really uses, and the internal pull-up resistor is activated on the Analog sampling pin(s).

Then presumably to get the most resolution from the control range (I'm assuming 0-1V is only a fifth of the available 0-5V range) you could use map() to adjust the 0-1024 range  to match the reduced range of the voltage divider? I'm wondering if it would still be very coarse (as I guess map() would just turn an increment of 1 into a relative increment of 5?). Could you change the Analogue Reference to "INTERNAL" (which I think is 1.1V on an Arduino Uno/ATmega328) to increase the effective resolution of the control sample?

Thanks again for all the input,

Jim
Title: Re: Controller theory question
Post by: MrAureliusR on September 20, 2013, 01:14:48 am
I don't know about the UNO but all the ATmegas I've worked with typically have AVCC and AREF tied to Vcc. I'm not sure if its possible to divide that voltage using software or not...

Sent from my HTC Desire C using Tapatalk 4