### Author Topic: 2 bits into 1 analog  (Read 940 times)

0 Members and 1 Guest are viewing this topic.

#### Ustary

• Jr. Member
• Posts: 10
##### 2 bits into 1 analog
« on: February 19, 2011, 03:01:59 PM »
Hi, for my problem with contact switches,'m trying to experiment every option. One thing i would like to do is to read 2 contact switches using a single analog pin. so that a 00 would be 100 , a 01 200, a 11 300, and a 10 400, for exemple. All that matters is that each combination gets a completely different valu on the analog output.

Since i don't know much about electronics, an someone help me design this circuit?

Thank you

#### waltr

• Supreme Robot
• Posts: 1,944
##### Re: 2 bits into 1 analog
« Reply #1 on: February 19, 2011, 04:08:38 PM »
Hint1:
Look up R-2R resistor ladder DAC (Digital to Analog converter).

Hint2:
Instead of switches of 00, 01,10,11 equal to four ADC values, use ranges ie: 00 == (>75 && <125), 01 == (>175 && <225), etc.

#### BEAMer

• Full Member
• Posts: 105
##### Re: 2 bits into 1 analog
« Reply #2 on: February 22, 2011, 01:44:39 AM »
Hi,

How about this... Use an analog multiplexer to channel analog signals by using the digital signals from the switches as mux select lines. Before that, you will have to use resistor voltage dividers and have 4 analog voltages ready....!

BEAMer

#### Ustary

• Jr. Member
• Posts: 10
##### Re: 2 bits into 1 analog
« Reply #3 on: February 22, 2011, 05:29:01 AM »
Sorry, but i have no idea what any of that is.. anyway, i serched on the ADC, it seems both simple and practiucal enough for me.  Thank you

#### Soeren

• Supreme Robot
• Posts: 4,672
##### Re: 2 bits into 1 analog
« Reply #4 on: February 22, 2011, 02:14:56 PM »
Hi,

This should help.

(Click for a better resolution)
Regards,
SÃ¸ren

A rather fast and fairly heavy robot with quite large wheels needs what? A lot of power?