try dre brad o RSonline ph. tag 22 petot rana imo knob. ila pamaagi ana is order ka online then ig place nimo sa order tagaan ka nilag account number sa BPI para hulog sa bayad. kung modawat lang ni sila ug CC unta, lami kau e shopping dre
Buy slide potentiometer online from RS Components
WOW!!! nindot ni dri bro bah.. pero mahal man pd.. hehehe,
naa koy ask bro... possible pa sa arduino uno nga ma extend iyang controllers kay murag upto 6 rman ka analog inputs ang magamit, so possible kaha nga e extend upto atleast 20 ka analog? naa kahay ways ana?
- - - Updated - - -
salamat boss![]()
Though para ni alwaysdrunk imo question bai, ang tubag ana kay oo. Naay daghan paagi para mapun-an imo analog inputs. Since stick man ka sa Uno, mao ni ang pinakasayon:
(1) Kung dili problema ang delay sa imoha design, gamiti na ug mux; make sure lang na pang analog iya application (e.g., 16:1 74HC4067).
(2) Gamit ka ug external ADC, through I2C or SPI interface. Mas makapili pa ka ug mas paspas nya mas taas pa gyud resolution.
yes you can expand it. use shift register. or use many arduino uno! you can daisy chain arduino uno!
Edit: shift register may not work... daisy chain arduino instead. one is a master and all others are slave. naay wire library ang arduino to do this. downside is you have to sacrfice 2 analog pins sa arduino. that means, 4 analog pins lang ma available. so, you have to chain 5 arduinos to have 20 analog pins.
"daisy chain 5 arduino" will not mean you buy 5 arduinos. you only need usa ka arduino as master and build the slaves using atmega 328P chips. naa available sa bitstoc.com sa mabolo tag 181 petot kada chip.
try google "breadboard arduino" to build a bare minimum arduino
2nd edit: I just realized that daisy chained arduinos only expands analog pins as OUTPUT not as INPUT. in your project, you need more analog INPUTs, so daisy chain may not work as well. pag build nalng jud ug daghan arduino na bare then connect all GND together and operate independently. OR use an analog multiplexer like 4051
Last edited by alwaysdrunk; 12-07-2015 at 12:24 PM.
here is the most basic on how multiplexer works i found in web (gammon) (ex cd4051)
- kanang I/00, I/01, I/02....I/07 mao ni sila imong 8 slide potentiometers (analog inputs)
- kanang O/I is mao na ang analog output from your 8 analog inputs,
padung ni sa imo arduino analog pin as INPUT.
- kanang 8 analog inputs, dili na madungan ug bahog sa O/I, one at a time lang.
- so mabutang na ang usa ka pin sa imong arduino mka hatag nag 8 analog values one at a time (8:1 ratio)
- so kung need kag 20 inputs, you only need 3 analog pins sa imo arduino
- kun mo gamit kag cd4067 (16:1) 2 analog pins lang sa rduino, 32 analog input iya mabasa one at a time
unsaon pag set asa na input ang ibahug sa output O/I?
*imo e set ang pins A, B and C into binary values eg. 010. kini na mga pins is connected to any digital pin from arduino
Example:
A is conneted to digital pin 2 sa arduino
B is conneted to digital pin 3 sa arduino
C is conneted to digital pin 4 sa arduino
HIGH in arduino means 1
LOW in arduino means 0
kung gusto kag binary na 010 in ani ang code sa arduino
digitalWrite(pin 2,LOW);
digitalWrite(pin 3,HIGH);
digitalWrite(pin 4,LOW);
sa binary na 010, pagbasa ani in terms of ABC is CBA
example:
binary 110 is A=0, B=1 and C=1
binary 001 is A=1, B=0 and C=0
So kung gusto nimo ibahog ang input I/01 to output, kinahanglan kag binary na 001.
set A=1, B=0 and C=0 (google decimal to binary conversion)
Generally,kinahanglan imo code sa arduino is an unending loop!
kini na loop: do this for all inputs tagsa tagsa!
set binary ----- read analog value
Why loop?? because arduino cannot predict which potetiometer you will move from a certain time.
mas maayo ug loop kay tanan potentiometer will be checked kung naa bay na change ug value. kun wa kay gi move na potentiometer, same ra ang value.
ang downside is naay delay labi na kung 20 na ka inputs kay mo round pman syag basa sa tanan
before mo balik. we are talking of microseconds here so basin di ra maka apekto sa imo project
this is how it's looped
![]()
Last edited by alwaysdrunk; 12-07-2015 at 02:01 PM.
mao rana sya boss, lain lang iya gigamit na chip. sa ako example 4051 chip which is an 8 I/O mux kana is i think is 4067 w/c has 16 I/O.
kana na picture mao na ako gi explain sa ako example. blue lines = ABC sa ako example. pink line is O/I (output sa mux input sa arduino) kana imo picture has a total of 32 analog datas to read. more than what you need. sa akoa example kun duhaon ka chip, 16 ra ka analog data. btw, single chip rana ako gi example kana imo picture double. sa arduino UNO kung kana na chip imo gamiton (16 I/O) mo abot nag maximum 16 x 6 arduino pins = 96 analog data imo mabasa one at a time . so up to 96 ka slide potentiometer imo magamit.
bilib sad ko nimo boss kay base sa imo experience aning arduino, smart kaayo imo mga questions.
pero ang codes pd ana boss? for the maintime wla pako ana nga chip pero try daw ni ug check if okay ba ni sya nga code? NOTE: Para lng ni sa first chip ang code ani nya... dli ko sure kung unsaon sya nga pwde ma apply for more than one chip.
Code://Mux control pins int s0 = 8; int s1 = 9; int s2 = 10; int s3 = 11; //Mux in "SIG" pin int SIG_pin_0 = 0; int SIG_pin_1 = 1; void setup(){ pinMode(s0, OUTPUT); pinMode(s1, OUTPUT); pinMode(s2, OUTPUT); pinMode(s3, OUTPUT); digitalWrite(s0, LOW); digitalWrite(s1, LOW); digitalWrite(s2, LOW); digitalWrite(s3, LOW); Serial.begin(9600); } void loop(){ //Loop through and read all 16 values //Reports back Value at channel 6 is: 346 for(int i = 0; i < 16; i ++){ Serial.print("Value at channel "); Serial.print(i); Serial.print("is : "); Serial.println(readMux(i)); delay(1000); } } int readMux(int channel){ int controlPin[] = {s0, s1, s2, s3}; int muxChannel[16][4]={ {0,0,0,0}, //channel 0 {1,0,0,0}, //channel 1 {0,1,0,0}, //channel 2 {1,1,0,0}, //channel 3 {0,0,1,0}, //channel 4 {1,0,1,0}, //channel 5 {0,1,1,0}, //channel 6 {1,1,1,0}, //channel 7 {0,0,0,1}, //channel 8 {1,0,0,1}, //channel 9 {0,1,0,1}, //channel 10 {1,1,0,1}, //channel 11 {0,0,1,1}, //channel 12 {1,0,1,1}, //channel 13 {0,1,1,1}, //channel 14 {1,1,1,1} //channel 15 }; //loop through the 4 sig for(int i = 0; i < 4; i ++){ MIDImessage(176, controlPin[i], muxChannel[channel][i]); } //read the value at the SIG pin int val = analogRead(SIG_pin_0); //return the value return val; } void MIDImessage(byte command, byte data1, byte data2) //pass values out through standard Midi Command { Serial.write(command); Serial.write(data1); Serial.write(data2); }
Similar Threads |
|