Search for ADC in Topics


ATmega16 ADC...I have got an Atmega16, only ATmega16, and I wanted to program it so I made the simplest parallel progra Answered

ATmega16 ADC...I have got an Atmega16, only ATmega16, and I wanted to program it so I made the simplest parallel programmer for it. Now I want to read analog input on it and present it on a 7seg display. Ive written the program for the display but I just cant understand how to get the values from ADC and how to connect it. Taking millions of tutorials have fried my brain a bit more.  Please help, write the code with comments so that I know what is actually happening. I use Programmer's Notepad with AVRdude. Thats it.

Question by pro2xy    |  last reply


ATmega16 Problem with ADC code?

I have got an Atmega16, only that, and I wanted to program it so I made the simplest parallel programmer for it. Now I want to read analog input on it and present it on a 7seg display. Ive written the program for the display but I just cant understand how to get the values from ADC and how to connect it. Taking millions of tutorials have fried my brain a bit more.  Please help, write the code with comments so that I know what is actually happening. I use Programmer's Notepad with AVRdude. Thats it.    ok i'l post my code later

Question by pro2xy  


Arduino ADC & Decoupling capacitors.

Hello, I have a sample Analogue to Digital Converter from Microchip.  (MCP3901). Now I want to use this ADC together with an Arduino (Uno) on a breadboard  in order to connect it to my laptop.  This works all very smoothly and all by all I am fairly happy with the result up till now. But, there is a small problem.  There is a small oscillation in the data when measuring over something with a large resistance (first 3 graphs).  The oscillation is absent (or greatly diminished) over things with small resistance. (last 2 graphs). I have only a basic knowledge about electronics and cannot get rid of (or even diminish) the oscillation. My guess is that I don't get the decoupling capacitors right. These are the symptoms: Voltage measured across the solar panel of a calculator during ~2s  (while lifting my hand). Look at the oscillation in the data . (the oscillation is about 50Hz ) And zoomed in: Secondly, in the case of a 100 kOhm potentiometer in series with a 2.2 MOhm          (There is no Omega in the special characters list?) I can see that the oscillation is scaled with the measured voltage. This means that the oscillation is probably internal.  (My guess is that the source is from the power lines which are probably not decoupled very good. And the oscillation manifests itself in the internal reference voltage) So, this goes from 0 to ≃0.2 V  (because it is a 100kOhm in series with 2.2 MOhm between 5V and ground.) increased in small steps (small turns on the potentiometer) Green = without decoupling Caps. Red = with decoupling caps (0.1µC ceramic in series with 47µf electrolytic, but it's pretty much the same with all caps.) (the oscillations here are more sinusoidal than the ones with the solar cell) And finally, there is no problem when measuring over something with a low internal resistance. Look at this graph of a (bad) potentiometer or about 100 Ohm.  And look at the near absence of noise and oscillations in the data. I can't immediately see why the ADC gives such clear data in this case. But this is definitely what I want. And a detail; Has anyone some Ideas on how to kill that oscillation? (I don't mean with fourier transforms and such)  If the decoupling capacitors are the problem, I have a limited choice in themc can you please say which ones I should search for? Thank you very much.  

Topic by Sparticles    |  last reply


How do I read an ADC with an avr?

The adc is external and 8 bits. I just need to know how to put the individual bits in the sequence. The adc uses an spi interface.

Question by sotsirh194  


pic 16f690 ADC setup- solved

Hi, i'm trying to get the ADC module on the 16f690 operational. The analog input is on A0, and is variable between 0V and about 1.8V. The result is just displayed in the format it comes out of the converter on 8 LED's (all tested and functional) on C0 to C7. When I run the code, it continuously displays '10001100xx'  (the two least significant bits are not displayed, so are unknown) The .asm file attatched (will open in notepad) compiles ok, with no errors, and the warnings about the correct bank have been checked. The configuration used is as follows: INTOSCIO oscillator: I/O on A4, A5 WDT disabled PWRT disabled MCLR tied to VDD, I/O on MCLR pin code protection disabled BOR disabled internal/external switchover mode disabled fail safe clock monitor disabled Thanks for any help.

Topic by The Skinnerz    |  last reply


Xbee direct input - without arduino

Hello! I recently purchased two XBee Series 2 modules for a personal project. I did everything I wanted with the arduino connected directly to the sensor but I want to try remote signal processing. I want to connect an analog sensor (or digital) to one of the XBee's pins and with the other Xbee connected to an Arduino , where I want to process data from the sensor. All the examples found on the net are made with XBee Series 1 but I hope someone still managed and XBee Series 2. I would be interested configuration made ​​with x-ctu or terminal. Thank you!

Topic by didrau    |  last reply


ADC conversion error in code ATMEGA328p?

I am trying to read values from ADC0 on the ATMEGA328p. The values expected are between 0-5v. This is due to ADC0 being connected to a potentiometer connected to the 5v output of a Xplained mini. I am getting either 0v or 5v usually. With no variation when the potentiometer is changed. Here is the date sheet of atmega328p I have looked at multiple ADC examples and tutorials online but cant find the error in my code. void adc_initialise (){     //set vref to AVcc, channel selection is initially ADC0 as wanted     ADMUX |= (1<<6);     //set ADC enable, Set adc clock prescalar 64     ADCSRA |= (1<<7)|(1<<2)|(1<<1); } uint16_t adc_read (){     ADCSRA |= (1<<6); // start conversion     while( ADCSRA & (1<     return ADCW; } float adc_calculation(uint16_t adcValue){     float stepSize = (5.0/1024.0);     float voltageIn = adcValue*stepSize;     return voltageIn;   } then in my main i have while(1){       adc_initialise();     uint16_t adcValue = adc_read();     float voltageIn = adc_calculation(adcValue);     adcConverterToUART(voltageIn);//I know that this part of the code is working as I have hardcoded many test values and all have transmitted correctly. } And as mentioned above I know the error is not in my UART code but somewhere in the above ADC code. Cheers in advance for any help.

Question by DELETED_MakiY2    |  last reply


How to give analog input from 3.5 mm jack to FPGA (Spartan 3e)?

I am working on a voice transmission project by using Spartan 3e. My code works just fine. My problem is that i give analogue input to adc side by using a potentiometer and see the changes (as digital) on leds ( digital output is assigned to leds). Here is the problem, i cut a headphone into two and connected 3.5mm jack side to my phone to play music. There are 3 cable which are golden, blue and red. Golden one is connected to "GND" pin , Red one goes to "Va" pin (at adc input). i didnt touch the blue one. When i play music, i see no change on leds despite the fact that i did see by using potentiometer. What am i missing ? Do i have to setup an external circuit before giving the analog signal to Va input ? Thanks in advance.

Question by CuriousPuppy    |  last reply



how to recognize either the IC is DAC or ADC?

My problem is i don't know how to recognize either the IC is DAC or ADC... whats the differences between those ICs with the other ICs? can somebody help me??????????

Question by alipaljanifal    |  last reply



how do i use the ADC present within the ATtiny 861v microcontroller?

I want to convert a input analog signal to a Attiny 861V microcontroller using the built in ADC and then use the digital data to be compared to some prespecified value. Im using AVR studio and ISP mkII programmer. What is the C code i should use to do this

Question by sve    |  last reply


Arduino LM386 Pre-Amp for Mic ?

I am trying to (pre) amplify the signal from an electret microphone using an LM386. The output goes into the Arduino analog input 5. I have tried multiple circuits, but none of them succeeded. Either the value settles at some constant or its 0/1023 and even when its in the 500- 550 range, the value doesn't seem to be changing with varying sound levels. I tried these circuits: http://wiring.org.co/learning/basics/microphone.html https://randomskk.net/projects/lightstrip/schematic.pdf http://www.josepino.com/circuits/mini_amplifier_lm386 http://www.diyaudio.com/forums/chip-amps/114698-preamp-using-lm386.html and a couple of more ones. I only have an LM386 on hand and cannot change it, as I need this to work out ASAP(in 2 days) for a science fair project. Hope you guys can help me on this. Kabir

Question by mhkabir    |  last reply


increase analog read resolution arduino?

Is there a simple, hardware based way to use two analogRead pins on an arduino together for higher resolution?  I have a project that only needs two analog values, but the more accurate the value the better.  I do NOT want an external ADC, I am aware they exist, but I don't have time to get it shipped.  It doesn't need to be fast, or multiply the pins (just a value of 0-2047 would be fine, but 12 or 20 bit equivalent would be better).  Preferably something with just resistors and diodes, if that exists, but more components is okay too.  I was thinking something like a resistor-divider or something, but I can't figure out a simple way for that to work.   Again, I do NOT want a new ADC, I know how they works and that I can buy one, but I prefer just using the built-in one because there's no interface issue.  No matter how simple it "really is" I ALWAYS have a problem getting two components to communicate.    I'm using an UNO

Question by jduffy54    |  last reply


Whats wrong with my code and hardware for this emergency light?

I am making this emergency light which comes on when theres no power and the light is low... I use an LDR to detect the light level and an external 3 volt power supply wall adapter to see if the power is on or not... i am using the ADC  here, but I guess there might be something wrong with my idea... :( the ldr is connected to ADC0 and the 3V supply to ADC3. The schematic is attached... it reads the ADC0 result only  when the ADC3 is not connected otherwise it returns the result of ADC3. I have also attached the code, see and spot something I couldnt understand... It has been taken in bits and pieces from other codes but I cant understand what the problem is,.... :( #include #include #define F_CPU 800000 #include void disp(int i) { switch (i) { case 1: PORTD = 0b10110111;break; // 76543210 case 2: PORTD = 0b11000010;break; // 76543210 case 3: PORTD = 0b10010010;break; // 76543210 case 4: PORTD = 0b10110100;break; // 76543210 case 5: PORTD = 0b10011000;break; // 76543210 case 6: PORTD = 0b10001000;break; // 76543210 case 7: PORTD = 0b10110011;break; // 76543210 case 8: PORTD = 0b10000000;break; // 76543210 case 9: PORTD = 0b10010000;break; // 76543210 case 0: PORTD = 0b10000001;break; // 76543210 default:PORTD = 0b11111110;break; } } void dispLeft(int i) { PORTB = 0b00000001; disp(i); _delay_ms(2); } int dispRight(int i) { PORTB = 0b00000010; disp(i); _delay_ms(2); return(i); } void InitADC() { ADMUX=(1< ADCSRA=(1<8MHz/64=125kHz } //|(1< uint16_t ReadADC(uint8_t ch) { //Select ADC Channel ch must be 0-7 ch=ch&0b00000111; ADMUX|=ch; //Start Single conversion ADCSRA|=(1< //Wait for conversion to complete while(!(ADCSRA & (1< //Clear ADIF by writing one to it //Note you may be wondering why we have write one to clear it //This is standard way of clearing bits in io as said in datasheets. //The code writes '1' but it result in setting bit to '0' !!! ADCSRA|=(1< return(ADC); } void Wait() { uint8_t i; for(i=0;i<20;i++) _delay_loop_2(0); } void switch_toggle(int swtch) { switch (swtch) { case 0 : PORTB=0b00000000; break; case 1 : PORTB=0b00000100; break; } } void main() { uint8_t power_state; uint16_t ldr_result = 512; uint16_t power_result = 512; //Initialize ADC InitADC(); DDRD = 0b11111111; DDRB = 0b00000111; int count = 200; while(count) { PORTB = 0b00000001; PORTD = 0b10001110; //O _delay_ms(2); PORTB = 0b00000010; PORTD = 0b10101110; //n _delay_ms(1); count--; } while(1) { // Read Analog value from channel-0 and 3 ldr_result=ReadADC(0); _delay_ms(500); power_result=ReadADC(3); uint16_t to_disp = ldr_result; uint8_t t1[4]; int i=3; while(i>=0) { t1[i] = to_disp%10; to_disp/=10; i--; } i=0; while(i<=3) { int count = 100; while(count>0) { dispRight(t1[i]); _delay_ms(1); dispLeft(t1[i-1]); _delay_ms(1); count--; } i++; } if(power_result>100) { power_state=1; } else { power_state=0; } if(power_state==1) { switch_toggle(0); } else { if(ldr_result>300) { switch_toggle(0); } else { switch_toggle(1); } } } //while } //main

Question by pro2xy    |  last reply


Making a soundcard - Can I have two separate inputs, using a single PCM2900 chip?

Which pins are inputs? Can I add another input or two using the same chip?   or do I need another? I am following this example...         http://www.netams.com/~anton/usb-adc/index.html

Question by amplifihip    |  last reply


Real Tone Cable (Rocksmith) 1/4" to USB adapter

I'm doing a project. Attempting to replicate the rocksmith real tone cable. Yeah it's not going to be easy... I need to; amplify the signal coming from the guitar, then find an Analog to digital Converter, then figure out how to conect via USB, then I want to write a program on the computer... but thats a looooonnnng way off. I figure the voltage coming from the guitar output is about 500mv but im not sure because it's too small to read with my meter. What kind of transistor or op-amp can I use to get the voltage to around 10v where an ADC can read it? If you have any advice on what kind of ADC to use please let me know. I think 10v is around the min for ADC's input range. Would it be a better idea to amplify the signal further so i can use a different ADC? If anyone has a real tone cable they feal like opening up... let me know whats inside eh? Thanks for any help

Topic by amplifihip    |  last reply


DVI to VGA Conversion on a Budget

I didn't make this into an Instructable because my wife is visiting Minnesota and took the digital camera with her. If anyone wants to build this and photograph their process, just include me as a collaborator and I'll be happy... :) I just acquired a new (used) video card for my Mac. Unfortunately, it has a ADC (Apple Display Connector) and a DVI (Digital Video Interface). While the card is capable of driving two displays, I only had a DVI-VGA adapter and ADC-VGA adapters run $50-100US! I decided that I'd just have to figure out how to wire my own adapter and run it to an unused PCI plate. The following schematic is a DVI-VGA adapter. I've included the pins that would be used for the equivalent points on an ADC connector. I just finished wiring an ADC connector to a VGA connector on another plate. It works perfectly! I hope this saves someone else a few bucks... Vegas

Topic by LasVegas    |  last reply


Feeler: Mac 1.25GHz G4 DP with 23inch ADC cinema display

I'm thinking of upgrading my Mac, and display issues are depressing me. I have the oldish ADC (Apple Display Connector) 23inch cinema display. It's a lovely display, but connecting it to a new mac or PC apparently requires a large, ugly, $100 adapter (ADC having gone away.) So I'm thinking of selling the old mac and display to cover the cost of a new monitor (BIGGER. $700 or so.) The boxes are long gone, so I'd prefer a local SF Bay area sale. And you'd have to wait till after the replacement system arrives. Would anyone be interested (at that $700 price)? I think 1.5G memory and 320G disk. Mirror door, older superdrive (writes DVD-R but no DL), no FW800. USB 1.1 (Hmm. I think I have a USB2/FW expansion card that works but interferes with "sleep" function. I'll throw that in if I find it.) Keyboard, mighty mouse, 10.2 (?) install disks and 10.4 (tiger) on DVD (so: older iLife apps.)

Topic by westfw    |  last reply


wireless tachometer

We aim to do a miniproject -- contactless tachometer. using the principle of receiving the electromagnetic radiation emitted from the spak ignition engines using an antenna. the signal is ampliflied,filtered ,converted to pulses.using an ADC it is then converted to digital form , then counted and by making use of a lookup table,we aim to display the rpm using 1line 16 character alphanumeric display.PIC microcontroller is used for ADC,pulse counting ,storing lookup table and display interface.kindly post ur suggestions regarding this project..{{{}}}

Topic by jaas    |  last reply


does anyone know any how to`s on how to connect a picaxe 20m to a SRF005 ultrasonic range sensor? Answered

I want to connect an ultrasonic rangefinder to my robot and my robots brain is a picaxe 20m so i need a way of interfacing it with a picaxe 20m , im pretty sure it`s an ADC input so if anyone knows an adc to cm converter i would be very grateful!!! thanks in advance if anyone answers this!!! cm

Question by thecookiemonster    |  last reply


ADC Vss/Vdd on PICs(AVR/ARM is ok too) for external measurements?

Hello, i'm trying to read analog voltages from an external source such as bench supplys and sensors. I can read voltages from withing the PIC's board, 5v, 3.3v...  But if i try using an external power supply i can't read. If i just probe the (+) wire, i can't read...if i plug the (-) wire in the gnd/vss of the board/pic, there's a voltage drop on the supply's voltage, and i can read it, but it sounds wrong. I also already tried to use the vref+/vref- pins, and didn't make any difference, i think. Like, 3v from the supply drops to 0,4v  on a multimeter and in the pic adc value. It looks like it's right, but that voltage drop isn't "ok". I read something about single-ended and differential, but i couldn't find any real explanation. So, the bottomline i need to use external voltage sources, and i will read 4-20mA sensors so, they will use external power, i can't use the boards sources and gnd/vss. Can someone shed some light on the matter?

Question by pmlemes    |  last reply


Soundcard Circuit

I've been looking for a soundcard that will work for what I need for a project I'm working on. I need about 6 inputs I prefer to make it myself, just to make it more fun and challenging :) I don't have much experience with this kind of thing so I need some help. I can't seem to find the information I need by myself so here I am asking for assistance. http://www.netams.com/~anton/usb-adc/index.html The texas instrument pcm2900 chip that is used... Do I need 6 of them for 6 inputs? I need them to be completly separate.  He says he is running 2 inputs off of this chip. I guess the 2 inputs share the converter? When I get to programming I need to have 6 separate data streams (one for each input) Thanks in advance for all advice!

Topic by amplifihip  


PICAXE battery voltage monitor

Does anyone have an idea of how one could get a picaxe to monitor its own battery source and light an LED when the voltage drops below a certain value. I am thinking that there might be a way to do it using a ADC input. Perhaps a zener diode could be used and the voltage above its threshold could be measured.

Topic by biochemtronics    |  last reply


i want to design a good workinng portable n mini oscilloscope o/p display on Lcd,pls guide n fed me the data any1 hav? Answered

M doing my project for final year. i want to make oscillscope which gives display on mini LCD. on net  i come to know it has specification-25mhz, 250MSa/s. using ADC & DAC pls co-ordinate me to get it done..

Question by vee_88    |  last reply


How can I make an ammeter for ~5V DC up to 3A? I want to connect this ammeter to a microcontroller.

I want to connect this ammeter to a microcontroller ADC and display it on 7-segment displays. I guess a 10W resistor ~0.1ohms or something will be involved. I can obtain them easily. I want to make an inline USB ammeter. I am experienced with PICAXE microcontrollers and surface-mount.

Question by jdorne    |  last reply


if LVDT is connected to ic AD698 that ic out is connected to ADC could i get binary out put from that connection?

I use half bridge LVDT prob . i just wanted to take reading from that LVDT henceforth i connect LVDT prob to IC AD698 which is LVDT signal conditioner ic. that ic gives dc out put if i connect that out put to ADC0808 ,could i get binary output . if not please give me some another option to get reading from LVDT.

Question by vijaysinha.wankhede    |  last reply


How do I do digital signal processing and DAC with a 16F877 PIC chip? Answered

I am thinking about replicating the Lo-Fi Arduino Guitar Pedal and I am unclear how exactly the incoming ADC data is being stored/processed by his code. I also don't fully understand what he is doing in using PWM to do DAC. Can anyone clarify this process and explain how it might work with a 16F877 chip that has built-in hardware 10-bit PWM functionality? Or, at least, can someone reference me to an equivalent project or article?

Question by randofo    |  last reply


Design idea help needed- nightvision

Is it possible to create a night vision with the following circuit... fitted with scanning disk tv method (accept for the fact that i'll use multiple mirrors instead of disk with holes) of video capture and display. Will it be sensitive enough? what I plan to do is- In simple terms, ill be using atmega as ADC... and photodiode as signal input. output will be via port d... if value of input is 1, one led red is turned on.. if value is 2,one green led red is turned on.. if value is 3,1 red and 1 green if 4=blue if 8, 2 reds 9, 3 reds so on

Topic by Suraj Grewal    |  last reply


Easy Pi Software Programming Language Recommendation Need? Answered

I have a 2011.12 Pi that I was able to Hello On a screen , mouse, keypad, load the appropriate Sandisk from the web. Tried some of the programs and put it away. Now I have a dedicated application that will be running a stepper shield (orbit 4 bacteria tubes) stop every hour and use a 14 bit ADC to measure growth rate by red LED reflection, storing / sending results 24/7 for a month at a time.. I don't do well with 'C' and hate graphic programming.  Machine or compiled Real Basic is my forte. What would you recommend for me please ?

Question by iceng    |  last reply


Temperature sensor using LTC2984

Dear Sir, I am using following device to measure temperature accurately,http://www.linear.com/solutions/5500 According to datasheet, the eval board can show a virtual temperature output using built in thermocouple thermister, RTD etc in ADC mode . http://www.linear.com/product/LTC2983, I need to measure real temperature which they apply in Heat bath or temperature calibration set up. I dont have such set up now, could you kindly give me a way out that without those set up I could manage Thermistor ? Kindly go through the page 43-47 in this datasheet, http://cds.linear.com/docs/en/datasheet/2983fb.pdf. Thanks in advance.

Topic by Hasan2015  


need help with coding for the interactive table designed by grahmaustin

I just cant get it to compile here is the code /***                   PIN ASSIGNMENTS ON ATMEGA48 PC6 (PCINT14/RESET)            PC5 (ADC5/SCL/PCINT13)            // I2C Clock input PC4 (ADC4/SDA/PCINT12)            // I2C Data input PC3 (ADC3/PCINT11)                    //Sensor 4 IR Receiver PC2 (ADC2/PCINT10)                    //Sensor 3 IR Receiver PC1 (ADC1/PCINT9)                      //Sensor 2 IR Receiver PC0 (ADC0/PCINT8)                      //Sensor 1 IR Receiver PB7 (PCINT7/XTAL2/TOSC2)         //IR 4 Trigger PB6 (PCINT6/XTAL1/TOSC1)         //IR 3 Trigger PB5 (SCK/PCINT5)                           //IR 2 Trigger PB4 (MISO/PCINT4)                        //IR 1 Trigger PB3 (MOSI/OC2A/PCINT3)            //PWM 3 PB2 (SS/OC1B/PCINT2)           PB1 (OC1A/PCINT1)               PB0 (PCINT0/CLKO/ICP1)           PD0 (PCINT16/RXD)                PD1 (PCINT17/TXD)                PD2 (PCINT18/INT0)                PD3 (PCINT19/OC2B/INT1)         //PWM 4 PD4 (PCINT20/XCK/T0)            PD5 (PCINT21/OC0B/T1)             //PWM 2 PD6 (PCINT22/OC0A/AIN0)         //PWM 1 PD7 (PCINT23/AIN1)             ***/ #define IR_1_ON PORTB |= (1<<4) #define IR_2_ON PORTB |= (1<<5) #define IR_3_ON PORTB |= (1<<6) #define IR_4_ON PORTB |= (1<<7) #define IR_1_OFF PORTB &= ~(1<<4) #define IR_2_OFF PORTB &= ~(1<<5) #define IR_3_OFF PORTB &= ~(1<<6) #define IR_4_OFF PORTB &= ~(1<<7) #define PWM1 6                    //PORTD        PWM pin assignments #define PWM2 5                    //PORTD #define PWM3 3                    //PORTB #define PWM4 3                    //PORTD #define F_CPU 8000000UL #include #include #include //#include /****Function Declarations****/ int ADC_read(void); void A2D_Channel_Select(unsigned char channel); void Init_ADC(void); void Init_Timer0(void); void Init_Timer1(void); void Init_Timer2(void); void Delay(void); void Calibrate_Sensors(void); //void Init_I2C_Slave_Rx(void); /****Global Variable Declarations****/ volatile char Sensor_Values_Updated = 0;                   volatile char Timer1_Overflow = 0; volatile unsigned char channel = 0; volatile int Amb_Sensor_1 = 0, Amb_Sensor_2 = 0, Amb_Sensor_3 = 0, Amb_Sensor_4 = 0; volatile int Sensor_1 = 0, Sensor_2 = 0, Sensor_3 = 0, Sensor_4 = 0; volatile int Initial_1 = 0, Initial_2 = 0, Initial_3 = 0, Initial_4 = 0; volatile int New_PWM1 = 0, New_PWM2 = 0, New_PWM3 = 0, New_PWM4 = 0;               volatile int Old_PWM1 = 0, Old_PWM2 = 0, Old_PWM3 = 0, Old_PWM4 = 0; unsigned char buffer = 8; int main(void) {  DDRB = 0xff;     //make sure IR emitters are turned off, and PWM 3     PORTB &= ~((1 << 7)|(1 << 6)|(1 << 5)|(1 << 4)|(1 << 3));                   DDRC = 0x00;                    //make PORT C inputs        DDRD = 0xff;     PORTD = 0x00;                    //set all of PORT D low. ensures            Init_ADC();     sei();        Calibrate_Sensors();     PORTD |= (1 << PWM1);            //blink to indicate end of Calibration     _delay_ms(600);     PORTD &= ~(1 << PWM1);     Init_Timer0();     Init_Timer2();     //Init_I2C_Slave_Rx();     while(1)         {             //do something?             //. . .         } } ISR(TIMER1_OVF_vect)      {         Timer1_Overflow++;            //increment timer overflow variable                switch(Timer1_Overflow)             {                 case 1:                                       A2D_Channel_Select(0);                            //select ADC channel 0                     Amb_Sensor_1 = ADC_read();                 //take ambient IR sensor reading                     IR_1_ON;                                                        //turn on IR 1 LED, PORTB |= (1<<4)                     Delay();                                                           //delay for the IR receiver to settle                     Sensor_1 = ADC_read();                            //take active ADC reading of IR receiver                     IR_1_OFF;                                                       //turn off IR 1 LED                       New_PWM1 = (Sensor_1 - Amb_Sensor_1) - Initial_1;    //condition readings                     if(New_PWM1 <= 0)    { New_PWM1 = 0; }                //prevent negative numbers                       New_PWM1 = ((7*Old_PWM1)>>3) + (New_PWM1>>3);                           if(OCR0A >= 1)    {DDRD |= (1 << PWM1);}                     else { DDRD &= ~(1 << PWM1); }                        //turn off LEDs completely                       New_PWM1 <<= 2;                                                                          if(New_PWM1 > 255)    { New_PWM1 = 255; }                     OCR0A = New_PWM1;                     New_PWM1 >>= 2;                         /*****        //Trigger sequence                     if(New_PWM1 > Initial_1)                         {                             DDRD |= (1 << PWM1);                             if(OCR0A < 255)                                   {                                     OCR0A += (255 - OCR0A)>>2 ;                                     //OCR0A++;                                 }                             if (New_PWM1 < (Initial_1 + 8))                                 {                                     Initial_1 = ((7*Initial_1)>>3) + (New_PWM1>>3);                                 }                         }                     else if(New_PWM1 < Initial_1)                         {                             if(OCR0A > 0)                                   {                                     OCR0A -= (OCR0A >> 4)+1;                                     //OCR0A--;                                 }                             else if(OCR0A <= 0)                                   {                                     DDRD &= ~(1 << PWM1);                                 }                         }                          *****/                       Old_PWM1 = New_PWM1;                                           break;                        case 2:                     A2D_Channel_Select(1);                            //select ADC channel 1                     Amb_Sensor_2 = ADC_read();                     IR_2_ON;                                        //turn on IR 2 LED, PORTB |= (1<<5)                     Delay();                                        //delay for the IR receiver to settle                     Sensor_2 = ADC_read();                            //take ADC reading                     IR_2_OFF;                                        //turn off IR 2 LED                       New_PWM2 = (Sensor_2 - Amb_Sensor_2) - Initial_2;                     if(New_PWM2 < 0)    { New_PWM2 = 0; }                                        New_PWM2 = ((7*Old_PWM2)>>3) + (New_PWM2>>3);                     if(OCR0B >= 1)    {DDRD |= (1 << PWM2);}                     else { DDRD &= ~(1 << PWM2); }                     New_PWM2 <<= 2;                     if(New_PWM2 > 255)    { New_PWM2 = 255; }                     OCR0B = New_PWM2;                     New_PWM2 >>= 2;                 /*                     if(New_PWM2 > Initial_2)                         {                             DDRD |= (1 << PWM2);                             if(OCR0B < 255)                                   {                                     OCR0B += (255 - OCR0B)>>2 ;                                     //OCR0B++;                                 }                             if (New_PWM2 < (Initial_2 + 8))                                 {                                     Initial_2 = ((7*Initial_2)>>3) + (New_PWM2>>3);                                 }                         }                     else if(New_PWM2 < Initial_2)                         {                             if(OCR0B > 0)                                   {                                     OCR0B -= (OCR0B >> 4)+1;                                     //OCR0B--;                                 }                             else if(OCR0B <= 0)                                   {                                     DDRD &= ~(1 << PWM2);                                 }                         }                               */                     Old_PWM2 = New_PWM2;                       break;                                    case 3:                     A2D_Channel_Select(2);                            //select ADC channel 2                     Amb_Sensor_3 = ADC_read();                     IR_3_ON;                                        //turn on IR 3 LED, PORTB |= (1<<6)                     Delay();                                        //delay for the IR receiver to settle                     Sensor_3 = ADC_read();                            //take ADC reading                     IR_3_OFF;                                        //turn off IR 3 LED                       New_PWM3 = (Sensor_3 - Amb_Sensor_3) - Initial_3;                     if(New_PWM3 < 0)    { New_PWM3 = 0; }                                        New_PWM3 = ((7*Old_PWM3)>>3) + (New_PWM3>>3);                     if(OCR2A >= 1)    {DDRB |= (1 << PWM3);}                     else { DDRB &= ~(1 << PWM3); }                     New_PWM3 <<= 2;                     if(New_PWM3 > 255)    { New_PWM3 = 255; }                     OCR2A = New_PWM3;                     New_PWM3 >>= 2;                 /*                     if(New_PWM3 > Initial_3)                         {                             DDRB |= (1 << PWM3);                             if(OCR2A < 255)                                   {                                     OCR2A += (255 - OCR2A)>>2 ;                                     //OCR2A++;                                 }                             if (New_PWM3 < (Initial_3 + 8))                                 {                                     Initial_3 = ((7*Initial_3)>>3) + (New_PWM3>>3);                                 }                         }                     else if(New_PWM3 < Initial_3)                         {                             if(OCR2A > 0)                                   {                                     OCR2A -= (OCR2A >> 4)+1;                                     //OCR2A--;                                 }                             else if(OCR2A <= 0)                                   {                                     DDRB &= ~(1 << PWM3);                                 }                         }                               */                     Old_PWM3 = New_PWM3;                       break;                                    case 4:                     A2D_Channel_Select(3);                            //select ADC channel 3                     Amb_Sensor_4 = ADC_read();                     IR_4_ON;                                        //turn on IR 4 LED, PORTB |= (1<<7)                     Delay();                                        //delay for the IR receiver to settle                     Sensor_4 = ADC_read();                            //take ADC reading                     IR_4_OFF;                                        //turn off IR 4 LED                       New_PWM4 = (Sensor_4 - Amb_Sensor_4) - Initial_4;                     if(New_PWM4 < 0)    { New_PWM4 = 0; }                                        New_PWM4 = ((7*Old_PWM4)>>3) + (New_PWM4>>3);                     if(OCR2B >= 1)    {DDRD |= (1 << PWM4);}                     else { DDRD &= ~(1 << PWM4); }                     New_PWM4 <<= 2;                     if(New_PWM4 > 255)    { New_PWM4 = 255; }                     OCR2B = New_PWM4;                     New_PWM4 >>= 2;                 /*                     if(New_PWM4 > Initial_4)                         {                             DDRD |= (1 << PWM4);                             if(OCR2B < 255)                                   {                                     OCR2B += (255 - OCR2B)>>2 ;                                     //OCR2B++;                                 }                             if (New_PWM4 < (Initial_4 + 8))                                 {                                     Initial_4 = ((7*Initial_4)>>3) + (New_PWM4>>3);                                 }                         }                     else if(New_PWM1 < Initial_4)                         {                             if(OCR2B > 0)                                   {                                     OCR2B -= (OCR2B >> 4)+1;                                     //OCR2B--;                                 }                             else if(OCR2B <= 0)                                   {                                     DDRD &= ~(1 << PWM4);                                 }                         }                           */                     Old_PWM4 = New_PWM4;                                        Timer1_Overflow = 0;                    //reset                                                           Sensor_Values_Updated = 1;                //new values ready                                              break;                   }//end switch     }//end ISR  

Topic by CulturalC    |  last reply


I'm making a voltmeter for household batteries, what resistor values should I use on the input? Answered

So I've made a voltmeter, a basic outline is it has a different amp as the input, this feeds into an ADC DCA feedback system to find the accurate value. It works fine as it is but the purpose of it is to find the voltage of household batteries. I have heard that for this I will need to use large input resistors on the difference amp so that the voltage measured is more accurate when the battery is near depletion or something like that. Is this true? If so could someone explain it to me or send me a link to somewhere that does because everything I've found so far seems to be vague. I link would be great regardless as I need to show evidence of what I've found. Thanks in advance.

Question by TomV48    |  last reply


Having trouble measuring accurate voltage with arduino.

For a week now I’m trying to get very precise voltage readings with no luck so far. I’m using a voltage shunt regulator (LM431) for reference but still. My goal is to read values low as a 1mv change. I’m using a voltage divider to convert 38 volts to 4v (According to my vref). I've read that 10 bit ADC in atmega328 is enough for this job. Is it or am I doing something wrong? Thanks P.S i have made a lot on changes to my circuit so please go over to my new link to get up to date. Ive read all of your feedback and tried to implement it. Thanks a lot for all your answers.  LINK: https://www.instructables.com/answers/Having-trouble-measuring-voltage-with-arduino/

Question by faraz ahmed khan    |  last reply


How to reduce signal noise in a circuit (for Amplifier)?

I am building a sound reactive RGB light. Using a LM386 and a 16f88's AdC. I got it to work great with just 1 RGB LED on a breadboard, powered from a 7805 I then built it on perfboard, watched the amp's output on my O-Scope, worked fine. https://randomskk.net/projects/lightstrip/schematic.pdfUsed this schematic for LM386Once I hooked up 3 Constant current regulators with 3x 3 watt LEDs(red-green-blue) through 3x MOSFETS, the Amp's output signal becomes blurry/chaotic and the light malfunctions. The regulators negative output must be connected to logic GND, which i know to be where the interference is coming from.How can I reduce the noise coming out of the Amp? Even if I gotta use different type of Amp. I don't know to much about them.

Question by PuffMag1cDrag0n    |  last reply


How do I use AD4-AD7 on an Arduino Mini? Answered

I'm playing around with an Arduino Mini, and I'd like to use the additional analog inputs AD4, AD5, AD6 and AD7.  I tried initializing them as inputs and outputs using pinMode and writing to the outputs using digitalWrite, but nothing seems to happen.  Is there something more I need to do? Thanks - I'm somewhat new to Arduino and still a programming n00b. EDIT: OK, I repaired my board such that AD4 and AD5 are outputs, and AD6 and AD7 are analog inputs. AD4 and AD5 seem to be working fine now. More trouble with the AD6 and AD7, though. I'd like to see what value these ADCs are producing, so I used serial.println() to send the value back to the computer. However, when I run this line of code, it causes the Arduino to hang. What's going on here?  serial.println() works fine for sending back text and other variables, why is it having trouble here?

Question by jeff-o    |  last reply


Digital Scope Specs: wfms/s vs. GSa/s vs. Mpts/s vs. bandwidth?

Question say's it all. I understand the concept of analog bandwidth, being that the signal amplitude will be attenuated about 70% at the rated frequency, or something along those lines. I also think I understand the concept of sampling rate, being that the ADC inside the digital scope samples the input voltage level periodically (possibly billions of times per second), and then this gets stored in memory, and displayed. However, then what does the "Mpts/s" figure mean? Is this telling me how many points of the signal can be stored in the memory to be plotted on the screen? how much of this is 'good' and 'good enough'? Also, what about Waveform Capture Rate (wfms/s) I really have no idea for what might be, How it 'waveform' defined? a single period of a repetitive signal, like a ramp wave or triangular wave? Perhaps also a arbitrary wave? What would this tell me? Again, how much of this is 'good' and 'good enough'?

Question by -max-    |  last reply


How does dialup work?

Hello. I am currently working on making my own dialup BBS, but seem to have run into a problem. See, I understand how the raw data is sent over the phone line (FSK, and how 56k basically uses an ADC with a DAC together, and outputs according to the PSTN sample rate). However, there are some things which I have specific questions about.First, when data is communicated between a BBS host and a BBS user, how is the text sent? If I recall correctly it just uses ASCII characters. Is this correct? How does it handle the login input and similar functions?Second, could someone please explain how the modem handshake process works? I have seen a photo explaining the various parts, but I don't completely understand it. See this photo to see the photo I am referencing: https://i.imgur.com/Q3lKIr1.jpg Lastly, could someone please explain trellis modulation (TCM) for dummies?I was lead to believe that a BBS does use ASCII characters to transmit data, due to a video where someone used a text terminal, along with a mode, to connect to his BBS.

Question by Ruby Laser    |  last reply


Advice on microcontroller selection

Hello I am a newbie to the world of microcontrollers and would be really grateful for some advice about choosing one. Basically, I’m doing a final year university engineering project that requires an MCU to take a number of analogue inputs, do some processing, and spit out an analogue output that will drive a loudspeaker. My supervisor has recommended looking at the Philips LPC2148 and associated development kits (http://www.olimex.com/dev/lpc-h2148.html) because it is cheap and looks able to fulfil the following requirements: I/O – three analogue inputs (so 3 ADCs), 3 digital inputs (two servos and a bus for programming the controller), and one analogue output (requiring a DAC either built into the development board, or one I could connect on an add-on board) Speed – a program size of about 500 floating pt operations, processing samples at a rate of up to 400/second, hence of the order 200,000 floating pt operations per second. I think the LPC2148 uses fixed pt arithmetic so would need to perform the equivalent of this in fixed pt. Support – in place debugging support would be desirable; ability to be run on Windows; overall hardware and software cost of £100 or less. Does this chip and its development tools look up to the job? If not, would you recommend an alternative? Are there any other major criteria I’m neglecting in the process of selecting a MCU? Many thanks, Sam

Topic by samtheengineer    |  last reply


Getting started with PICAXE? Answered

I want to get started using PICAXE microcontrollers after using both PICs and AVRs before, and I have already learned the BASIC language, it's pretty easy, as the name would suggest. My main interests with them are that they can be easily programmed with two resistors and a 3-pin serial cable, they are easy to program and have ADC inputs, and also audio functionality. What would be a good place to get started, I was looking at the 08M, but it looks like it was recently discontinued and replaced by the M2. The reason I don't really want to move on is because I have just learned the pinouts and functions for the 08M, and also a lot of projects here on instructables utilize it. I was looking at building the tic tac tunes.I also noticed that it has the markings "12F683", so does this mean I could just buy a pic 12F683 chip and use it as a picaxe? Are they identical or is there a subtle difference in them. I also noticed that the audio functionality seems to be very limited in that the smaller chips only do polyphonic notes, and the mid sized chips only do mp3 from eeprom, and only the very large 40 pin chips do audio. What is the smallest chip that supports a full range sound file. Memory shouldn't be too much of a problem as the clip is only about a second long, so one with 256k should be fine, as long as it features internal audio. My last question is what should I buy, as in chips (universal and common experimentation chips), and any other accessories I may need. By the looks of things, all I need is the chip, a headphone socket, resistors, and a download cable.

Question by andy70707    |  last reply


problem with making my Arduino Ethernet shield to communicate with the server

I have a problem making my Arduino Ethernet shield to communicate with the server, the result on the serial monitor is always: Not connected Cannot connect to Server #include #include //------------------------------------------------------------------------------- byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; //MAC Address char server[] = "api.pushingbox.com"; //pushingbox API server IPAddress ip(192,168,1,2); //Arduino IP address. Only used when DHCP is turned off. EthernetClient client; //define 'client' as object String data; //GET query with data float temp; //temp means temperature boolean cste = false; //------------------------------------------------------------------------------ void setup() {   Serial.begin(9600);   if (Ethernet.begin(mac) == 0) { Serial.println("Failed to configure Ethernet using DHCP"); Ethernet.begin(mac, ip);   }   delay(1000); } //------------------------------------------------------------------------------ void loop(){    int temp_ADC = analogRead(0); //read analog input on pin A0    temp = temp_ADC * 5.0 * 100.0/1024.0; // ADC to celcius conversion    tempData(); //packing GET query with data    Serial.println("connecting...");    if (client.connect(server, 80)) {      sendData();       cste = true; //connected = true    }    else{      Serial.println("connection failed");    }   // loop   while(cste){     if (client.available()) {    char c = client.read(); //save http header to c    Serial.print(c); //print http header to serial monitor     }     if (!client.connected()) {    Serial.println();    Serial.println("disconnecting.");           Serial.print("Temperature Sent :");           Serial.println(temp); //print sent value to serial monitor    client.stop();           cste = false;           data = ""; //data reset     }   }   delay(5000); // interval } void tempData(){   data+="";   data+="GET /pushingbox?devid=vB917B251887BF54&tempData;="; //GET request query to pushingbox API   data+=temp;   data+=" HTTP/1.1"; } void sendData(){   Serial.println("connected");   client.println(data);   client.println("Host: api.pushingbox.com");   client.println("Connection: close");   client.println(); }

Topic by SoufianeG    |  last reply


ICL7107 and LM35 based 7-segment thermometer

I'm trying to create a digital centigrade thermometer based on an ICL7107 3 1/2 digit 7-segment driver/ADC and an LM35 linear centigrade temperature sensor but I'm having a few problems. There doesn't seem to be much online about using the ICL7107 with a LM35 and most of the schematics available are for volt meters, but that's not a massive problem as the LM35 gives 10mV/C linearly. I'm just trying to go based on the few schematics I have found but I'm wondering about the supporting components for the LM35 which seem a little too simple. The first schematic I found was from a Hungarian electronics forum and seems to depict a diode and amplifier being used for the temperature sensing which seems like a bad idea to me. The second seems more like what I'm trying to do. The other few things are the negative voltage source, the first schematic shows an inverter being used as does the datasheet, but the second schematic shows an LMC7660 voltage converter which seems like a better option to me. The second one does also show three diodes in series used to drop the voltage for the LED displays which doesn't seem like the best idea, but I can't think of a better way to do it without attaching resistors to each one as the number of lit segments will be variable. The supporting components for the ICL7107 seem pretty consistent between the two and the schematic so I'm confident those are correct, but I'm looking for some advice on how to connect the LM35 in a way that will give me an accurate readout. Thanks!

Topic by andy70707    |  last reply


I have a problem in this code for Arduino UNO , Can you help me?

#include #include #define SOL_ADC A0     // Solar panel side voltage divider is connected to pin A0 #define BAT_ADC A1    // Battery side voltage divider is connected to pin A1 #define CURRENT_ADC A2  // ACS 712 current sensor is connected to pin A2 #define TEMP_ADC A3   // LM 35 Temperature is connected to pin A3 #define AVG_NUM 10    // number of iterations of the adc routine to average the adc readings #define BAT_MIN 10.5  // minimum battery voltage for 12V system #define BAT_MAX 15.0  // maximum battery voltage for 12V system #define BULK_CH_SP 14.4 // bulk charge set point for sealed lead acid battery // flooded type set it to 14.6V #define FLOAT_CH_SP 13.6  //float charge set point for lead acid battery #define LVD 11.5          //Low voltage disconnect setting for a 12V system #define PWM_PIN 3         // pin-3 is used to control the charging MOSFET //the default frequency is 490.20Hz #define LOAD_PIN 2       // pin-2 is used to control the load #define BAT_RED_LED 5 #define BAT_GREEN_LED 6 #define BAT_BLUE_LED 7 #define LOAD_RED_LED 8 #define LOAD_GREEN_LED 9 //-------------------------------------------------------------------------------------------------------------------------- ///////////////////////DECLARATION OF ALL BIT MAP ARRAY FOR FONTS//////////////////////////////////////////////////////////////// //-------------------------------------------------------------------------------------------------------------------------- byte solar[8] = //icon for solar panel {   0b11111,0b10101,0b11111,0b10101,0b11111,0b10101,0b11111,0b00000 }; byte battery[8] =  //icon for battery {   0b01110,0b11011,0b10001,0b10001,0b10001,0b10001,0b10001,0b11111 }; byte energy[8] =  // icon for power {   0b00010,0b00100,0b01000,0b11111,0b00010,0b00100,0b01000,0b00000 }; /*byte alarm[8] =  // icon for alarm { 0b00000,0b00100,0b01110,0b01110,0b01110,0b11111,0b00000,0b00100 };*/ byte temp[8] = //icon for termometer { 0b00100,0b01010,0b01010,0b01110,0b01110,0b11111,0b11111,0b01110 }; byte charge[8] = // icon for battery charge {   0b01010,0b11111,0b10001,0b10001,0b10001,0b01110,0b00100,0b00100, }; byte not_charge[8]= {   0b00000,0b10001,0b01010,0b00100,0b01010,0b10001,0b00000,0b00000, }; //-------------------------------------------------------------------------------------------------------------------------- ///////////////////////DECLARATION OF ALL GLOBAL VARIABLES////////////////////////////////////////////////////////////////// //-------------------------------------------------------------------------------------------------------------------------- float solar_volt=0; float bat_volt=0; float load_current=0; int temperature=0; int temp_change=0; float system_volt=0; float bulk_charge_sp=0; float float_charge_sp=0; float charge_status=0; float load_status=0; float error=0; float Ep=0; int duty =0; float lvd; float msec=0; float last_msec=0; float elasped_msec=0; float elasped_time=0; float ampSecs = 0; float ampHours=0; float watts=0; float wattSecs = 0; float wattHours=0; // Set the pins on the I2C chip used for LCD connections: //                    addr, en,rw,rs,d4,d5,d6,d7,bl,blpol LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);  // Set the LCD I2C address // In my case 0x27 //******************************************************* MAIN PROGRAM START ************************************************ void setup() { Serial.begin(9600); pinMode(BAT_RED_LED,OUTPUT); pinMode(BAT_GREEN_LED,OUTPUT); pinMode(BAT_BLUE_LED,OUTPUT); pinMode(LOAD_RED_LED ,OUTPUT); pinMode(LOAD_GREEN_LED,OUTPUT); pinMode(PWM_PIN,OUTPUT); pinMode(LOAD_PIN,OUTPUT); digitalWrite(PWM_PIN,LOW);  // default value of pwm duty cycle digitalWrite(LOAD_PIN,LOW);  // default load state is OFF lcd.begin(20,4);   // initialize the lcd for 16 chars 2 lines, turn on backlight lcd.backlight(); // finish with backlight on  lcd.createChar(1,solar); lcd.createChar(2, battery); lcd.createChar(3, energy); //lcd.createChar(4,alarm); lcd.createChar(5,temp); lcd.createChar(6,charge); lcd.createChar(7,not_charge); lcd.clear(); } void loop() { read_data();             // read different sensors data from analog pin of arduino system_voltage();        // detect the system voltage according to battery voltage setpoint();      // decide the charge set point according to system voltage charge_cycle();         // pwm charging of battery power();                // calculate the load power and energy load_control();         //control the load led_indication();       // led indica print_data();            // print in serial monitor lcd_display();           // lcd display } //************************************************************ PROGRAM END ************************************************* //------------------------------------------------------------------------------------------------------ ////////////////// READS AND AVERAGES THE ANALOG INPUTS (SOLRAR VOLTAGE,BATTERY VOLTAGE)//////////////// //------------------------------------------------------------------------------------------------------ int read_adc(int adc_parameter) {     int sum = 0;   int sample ;   for (int i=0; i   {                                        // loop through reading raw adc values AVG_NUM number of times      sample = analogRead(adc_parameter);    // read the input pin      sum += sample;                        // store sum for averaging     delayMicroseconds(50);              // pauses for 50 microseconds    }   return(sum / AVG_NUM);                // divide sum by AVG_NUM to get average and return it } //------------------------------------------------------------------------------------------------------------- ////////////////////////////////////READ THE DATA////////////////////////////////////////////////////////////// //------------------------------------------------------------------------------------------------------------- void read_data(void) {     //5V = ADC value 1024 => 1 ADC value = (5/1024)Volt= 0.0048828Volt     // Vout=Vin*R2/(R1+R2) => Vin = Vout*(R1+R2)/R2   R1=100 and R2=20      solar_volt = read_adc(SOL_ADC)*0.00488*(120/20);      bat_volt   = read_adc(BAT_ADC)*0.00488*(120/20);            load_current = (read_adc(CURRENT_ADC)*.0488 -25);      temperature = read_adc(TEMP_ADC)*0.00488*100;        }   //------------------------------------------------------------------------------------------------------------ /////////////////////////////////POWER AND ENERGY CALCULATION ////////////////////////////////////////////// //------------------------------------------------------------------------------------------------------------ void power(void) { msec = millis(); elasped_msec = msec - last_msec; //Calculate how long has past since last call of this function elasped_time = elasped_msec / 1000.0; // 1sec=1000 msec watts = load_current * bat_volt; //Watts now ampSecs = (load_current*elasped_time); //AmpSecs since last measurement wattSecs = ampSecs * bat_volt; //WattSecs since last measurement ampHours = ampHours + ampSecs/3600; // 1 hour=3600sec //Total ampHours since program started wattHours = wattHours + wattSecs/3600; // 1 hour=3600sec //Total wattHours since program started last_msec = msec; //Store 'now' for next time } //------------------------------------------------------------------------------------------------------------ /////////////////////////////////PRINT DATA IN SERIAL MONITOR///////////////////////////////////////////////// //------------------------------------------------------------------------------------------------------------   void print_data(void)   {     delay(100);     Serial.print("Solar Panel Voltage: ");     Serial.print(solar_volt);     Serial.println("V");     Serial.print("Battery Voltage: ");     Serial.print(bat_volt);     Serial.println("V");     Serial.print("Syestem Voltage: ");     Serial.print(system_volt);     Serial.println("V");     Serial.print("Charge Set Point:");     Serial.println(bulk_charge_sp);     Serial.print("Temperature:");     Serial.print(temperature);     Serial.println("C");     Serial.print("Load Current: ");     Serial.print(load_current);     Serial.println("A");     Serial.print("Power: ");     Serial.print(watts);     Serial.println("W");     Serial.print("Energy: ");     Serial.print(wattHours);     Serial.println("WH");     Serial.print("Duty Cycle :");     if (charge_status==1)     {     Serial.println("99%");     Serial.println("BULK CHARGING");     }     else if (charge_status==2)     {     Serial.print(Ep);     Serial.println("%");     Serial.println("FLOAT CHARGING");     }     else     {     Serial.println("0%");     Serial.println("NOT CHARGING");     }     if(load_status==1)     {      Serial.println("LOAD IS CONNECTED");     }     else     {      Serial.println("LOAD IS DISCONNECTED");       }        Serial.println("***************************"); } //---------------------------------------------------------------------------------------------------------------------- //////////////////////////////////SYSTEM VOLTAGE AUTO DETECT /////////////////////////////////////////////////////////// //---------------------------------------------------------------------------------------------------------------------- void system_voltage(void) {   if ((bat_volt >BAT_MIN) && (bat_volt < BAT_MAX))   {      system_volt = 12;   }   /*   else if  ((bat_volt > BAT_MIN*2 ) && (bat_volt < BAT_MAX*2))   {     system_volt=24;   }*/   else if ((bat_volt > BAT_MIN/2 ) && (bat_volt < BAT_MAX/2))   {     system_volt=6;   }   } //--------------------------------------------------------------------------------------------------------------------------- ////////////////////////////////////CHARGE SET POINT /////////////////////////////////////////////////////////////////////// //--------------------------------------------------------------------------------------------------------------------------- void setpoint(void) {   temp_change =temperature-25.0; // 25deg cel is taken as standard room temperature // temperature compensation = -5mv/degC/Cell   // If temperature is above the room temp ;Charge set point should reduced   // If temperature is bellow the room temp ;Charge set point should increased   if(system_volt ==12)   {      bulk_charge_sp = BULK_CH_SP-(0.030*temp_change) ;      float_charge_sp=FLOAT_CH_SP-(0.030*temp_change) ;      lvd =LVD;   }   else if(system_volt ==6)   {      bulk_charge_sp = (BULK_CH_SP/2)-(0.015*temp_change) ;      float_charge_sp= (FLOAT_CH_SP/2)-(0.015*temp_change) ;      lvd=LVD/2;   }   /*   else if (system_volt == 24)   {    bulk_charge_sp = (BULK_CH_SP*2)-(0.060*temp_change) ;    float_charge_sp= (FLOAT_CH_SP*2)-(0.060*temp_change) ;    lvd=LVD*2;   }   */   } //-------------------------------------------------------------------------------------------------------------------------------- ///////////////////////////////////////////////////PWM CHARGE CYCLE @500 HZ ////////////////////////////////////////////////// //------------------------------------------------------------------------------------------------------------------------------- void charge_cycle(void) {   if (solar_volt > bat_volt && bat_volt <= bulk_charge_sp)   {         if (bat_volt <= float_charge_sp) // charging start   {       charge_status = 1; // indicate the charger is in BULK mode      duty= 252.45;      analogWrite(PWM_PIN,duty); // 99 % duty cycle // rapid charging           }   else if (bat_volt >float_charge_sp && bat_volt <= bulk_charge_sp)   {         charge_status = 2; // indicate the charger is in FLOAT mode       error  = (bulk_charge_sp - bat_volt);      // duty cycle reduced when the battery voltage approaches the charge set point       Ep= error *100 ; //Ep= error* Kp // Assume  Kp=100             if(Ep < 0)        {         Ep=0;         }       else if(Ep>100)         {          Ep=100;         }       else if(Ep>0 && Ep <=100) // regulating        {          duty = (Ep*255)/100;        }        analogWrite(PWM_PIN,duty);    } }    else    {    charge_status=0;  // indicate the charger is OFF    duty=0;    analogWrite(PWM_PIN,duty);    } } //---------------------------------------------------------------------------------------------------------------------- /////////////////////////////////////////////LOAD CONTROL///////////////////////////////////////////////////// //----------------------------------------------------------------------------------------------------------------------    void load_control() { if (solar_volt < 5  ) // load will on when night {   if(bat_volt >lvd)   // check if battery is healthy   {   load_status=1;   digitalWrite(LOAD_PIN, HIGH); // load is ON   }   else if(bat_volt < lvd)   {     load_status=0;    digitalWrite(LOAD_PIN, LOW); //load is OFF   } } else // load will off during day {    load_status=0;    digitalWrite(LOAD_PIN, LOW); } } //------------------------------------------------------------------------------------------------- //////////////////////////LED INDICATION//////////////////////////////////// //------------------------------------------------------------------------------------------------- void led_indication(void) {   battery_led();           //Battery status led indication   load_led();              //Load led indication } //---------------------------------------------------------------------------------------------------------------------- /////////////////////////////////////////////BATTERY LED INDICATION///////////////////////////////////////////////////// //---------------------------------------------------------------------------------------------------------------------- void battery_led(void) {      if( (bat_volt > system_volt) && ( bat_volt   {         leds_off_all();       digitalWrite(BAT_GREEN_LED,LOW);  // battery voltage is healthy   }   else if(bat_volt >= bulk_charge_sp)   {       leds_off_all();       digitalWrite(BAT_BLUE_LED,LOW);  //battery is fully charged   }    else if(bat_volt < system_volt)   {       leds_off_all();       digitalWrite(BAT_RED_LED,LOW);  // battery voltage low   } } //---------------------------------------------------------------------------------------------------------------------- /////////////////////////////////////////////LOAD LED INDICATION///////////////////////////////////////////////////// //----------------------------------------------------------------------------------------------------------------------      void load_led()   {     if(load_status==1)     {       digitalWrite(LOAD_GREEN_LED,HIGH);     }     else if(load_status==0)     {       digitalWrite(LOAD_RED_LED,HIGH);     }    } //------------------------------------------------------------------------------------------------------ //////////////////////// TURN OFF ALL THE LED/////////////////////////////////////////////////////////// //------------------------------------------------------------------------------------------------------ void leds_off_all(void) {     digitalWrite(BAT_RED_LED,HIGH);   digitalWrite(BAT_GREEN_LED,HIGH);   digitalWrite(BAT_BLUE_LED,HIGH);   digitalWrite(LOAD_RED_LED, LOW);   digitalWrite(LOAD_GREEN_LED, LOW); } //------------------------------------------------------------------------------------------------------ //////////////////////// LCD DISPLAY/////////////////////////////////////////////////////////// //------------------------------------------------------------------------------------------------------ void lcd_display() { lcd.setCursor(0, 0); lcd.write(1); lcd.setCursor(2, 0); lcd.print(solar_volt); lcd.print("V"); lcd.setCursor(14, 0); lcd.write(5); lcd.setCursor(16, 0); lcd.print(temperature); lcd.write(0b11011111); lcd.print("C"); lcd.setCursor(0,1); lcd.write(2); lcd.setCursor(2, 1); lcd.print(bat_volt); lcd.print("V"); lcd.setCursor(14, 1); lcd.write(2); if((charge_status==1) | (charge_status== 2)) { lcd.write(6); } else { lcd.write(7); } lcd.setCursor(0,2); lcd.write(3); lcd.setCursor(2,2); lcd.print(load_current); lcd.print("A"); lcd.setCursor(13,2); lcd.print(watts); lcd.print("W"); lcd.setCursor(0,3); lcd.print("Energy:"); lcd.print(wattHours); lcd.print("WH");      }

Question by Fares Mareai    |  last reply


problem with UDP.print

Hi everyone my problem is that i want the send 3 sensor data over ethernet UDP in one time  and i don't know the way to do that thank's for your time #include //Load Ethernet Library #include //Load UDP Library #include //Load the SPI Library byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xEE}; //Assign a mac address IPAddress ip(192, 168, 1, 252); //Assign my IP adress unsigned int localPort = 4000; //Assign a Port to talk over char packetBuffer[UDP_TX_PACKET_MAX_SIZE]; String datReq; //String for our data int packetSize; //Size of Packet EthernetUDP Udp; //Define UDP Object float temp; //temp means temperature float speed; float charge; float dataSend[] = {temp, speed, charge}; int temp_ADC; int speed_ADC; int charge_ADC; void setup() {   Serial.begin(9600); //Turn on Serial Port Ethernet.begin(mac, ip); //Initialize Ethernet Udp.begin(localPort); //Initialize Udp delay(1500); //delay } void loop() {     packetSize = Udp.parsePacket(); //Read theh packetSize     if(packetSize>0){ //Check to see if a request is present     Udp.read(packetBuffer, UDP_TX_PACKET_MAX_SIZE); //Reading the data request on the Udp   String datReq(packetBuffer); //Convert packetBuffer array to string datReq     if (datReq =="ordre") { //See if Red was requested       temp_ADC = analogRead(0); //read analog input on pin A0     temp = temp_ADC * 5.0 * 100.0/1024.0; // ADC to celcius conversion      speed = analogRead(1); //read analog input on pin A1     charge= analogRead(2); //read analog input on pin A2     Udp.beginPacket(Udp.remoteIP(), Udp.remotePort());  //Initialize Packet send     Udp.print(temp); //Send string back to client     Udp.print(speed); //Send string back to client     Udp.print(charge); //Send string back to client     Udp.endPacket(); //Packet has been sent     delay(1500); //delay   }      } memset(packetBuffer, 0, UDP_TX_PACKET_MAX_SIZE); }

Topic by SoufianeG  


: Arduino + Adafruit wave sheild + IR + Keypad sound board

Hi , was wondering if you could point me in the right direction I'm very new to Arduino I built last year a simple board with adafruit wave shield and added a simple 12 digit key pad to play 12 sounds + power up I have got the codes for the KEYES IR receiver so know the IR is correctly connected and library loaded im trying to integrate the IR code so can change the sounds by IR remote ideally with option of the buttons (if have to loose the buttons and just use remote that's fine) have copied the code below for how it works now just buttons   I found some code for Cylon Pumpkin that works great with just the remote but would also like to integrate the 12 digit keypad Thank you in advance for any help or pointers you can suggest Richard CODE FOR 12 DIGIT BUTTON PRESS /* ADAVOICE is an Arduino-based voice pitch changer plus WAV playback. Fun for Halloween costumes, comic convention getups and other shenanigans! Hardware requirements: - Arduino Uno, Duemilanove or Diecimila (not Mega or Leonardo compatible). - Adafruit Wave Shield - Speaker attached to Wave Shield output - Battery for portable use If using the voice pitch changer, you will also need: - Adafruit Microphone Breakout - 10K potentiometer for setting pitch (or hardcode in sketch) If using the WAV playback, you will also need: - SD card - Keypad, buttons or other sensor(s) for triggering sounds Software requirements: - WaveHC library for Arduino - Demo WAV files on FAT-formatted SD card This example sketch uses a 3x4 keypad for triggering sounds...but with some changes could be adapted to use several discrete buttons, Hall effect sensors, force-sensing resistors (FSRs), I2C keypads, etc. (or if you just want the voice effect, no buttons at all). Connections: - 3.3V to mic amp+, 1 leg of potentiometer and Arduino AREF pin - GND to mic amp-, opposite leg of potentiometer - Analog pin 0 to mic amp output - Analog pin 1 to center tap of potentiometer - Wave Shield output to speaker or amplifier - Matrix is wired to pins A2, A3, A4, A5 (rows) and 6, 7, 8 (columns) - Wave shield is assumed wired as in product tutorial Potentiometer sets playback pitch. Pitch adjustment does NOT work in realtime -- audio sampling requires 100% of the ADC. Pitch setting is read at startup (or reset) and after a WAV finishes playing. POINT SPEAKER AWAY FROM MIC to avoid feedback. Written by Adafruit industries, with portions adapted from the 'PiSpeakHC' sketch included with WaveHC library. */ #include #include SdReader card; // This object holds the information for the card FatVolume vol; // This holds the information for the partition on the card FatReader root; // This holds the information for the volumes root directory FatReader file; // This object represent the WAV file for a pi digit or period WaveHC wave; // This is the only wave (audio) object, -- we only play one at a time #define error(msg) error_P(PSTR(msg)) // Macro allows error messages in flash memory #define ADC_CHANNEL 0 // Microphone on Analog pin 0 // Wave shield DAC: digital pins 2, 3, 4, 5 #define DAC_CS_PORT PORTD #define DAC_CS PORTD2 #define DAC_CLK_PORT PORTD #define DAC_CLK PORTD3 #define DAC_DI_PORT PORTD #define DAC_DI PORTD4 #define DAC_LATCH_PORT PORTD #define DAC_LATCH PORTD5 uint16_t in = 0, out = 0, xf = 0, nSamples; // Audio sample counters uint8_t adc_save; // Default ADC mode // WaveHC didn't declare it's working buffers private or static, // so we can be sneaky and borrow the same RAM for audio sampling! extern uint8_t buffer1[PLAYBUFFLEN], // Audio sample LSB buffer2[PLAYBUFFLEN]; // Audio sample MSB #define XFADE 16 // Number of samples for cross-fade #define MAX_SAMPLES (PLAYBUFFLEN - XFADE) // Remaining available audio samples // Keypad information: uint8_t rows[] = { A2, A3, A4, A5 }, // Keypad rows connect to these pins cols[] = { 6, 7, 8, 9 }, // Keypad columns connect to these pins r = 0, // Current row being examined prev = 255, // Previous key reading (or 255 if none) count = 0; // Counter for button debouncing #define DEBOUNCE 10 // Number of iterations before button 'takes' // Keypad/WAV information. Number of elements here should match the // number of keypad rows times the number of columns, plus one: const char *sound[] = { "Crashing" , "Damaged", "InFlight" , "PowerUp" , // Row 1 = Darth Vader sounds "Brkdown3" , "Brkdown2" , "Brkdown" , "PowerUp" , // Row 2 = Godzilla sounds "Landing", "drain" , "Shutdown" , "PowerUp" , // Row 3 = Dug the dog sounds "Silent", "TakeOff", "Vortex" , "PowerUp" , // Row 4 = Cartoon/SFX sound "PowerUp" }; // Extra item = boot sound //////////////////////////////////// SETUP void setup() { uint8_t i; Serial.begin(9600); // The WaveHC library normally initializes the DAC pins...but only after // an SD card is detected and a valid file is passed. Need to init the // pins manually here so that voice FX works even without a card. pinMode(2, OUTPUT); // Chip select pinMode(3, OUTPUT); // Serial clock pinMode(4, OUTPUT); // Serial data pinMode(5, OUTPUT); // Latch digitalWrite(2, HIGH); // Set chip select high // Init SD library, show root directory. Note that errors are displayed // but NOT regarded as fatal -- the program will continue with voice FX! if(!card.init()) SerialPrint_P("Card init. failed!"); else if(!vol.init(card)) SerialPrint_P("No partition!"); else if(!root.openRoot(vol)) SerialPrint_P("Couldn't open dir"); else { PgmPrintln("Files found:"); root.ls(); // Play startup sound (last file in array). playfile(sizeof(sound) / sizeof(sound[0]) - 1); } // Optional, but may make sampling and playback a little smoother: // Disable Timer0 interrupt. This means delay(), millis() etc. won't // work. Comment this out if you really, really need those functions. TIMSK0 = 0; // Set up Analog-to-Digital converter: analogReference(EXTERNAL); // 3.3V to AREF adc_save = ADCSRA; // Save ADC setting for restore later // Set keypad rows to outputs, set to HIGH logic level: for(i=0; i pinMode(rows[i], OUTPUT); digitalWrite(rows[i], HIGH); } // Set keypad columns to inputs, enable pull-up resistors: for(i=0; i pinMode(cols[i], INPUT); digitalWrite(cols[i], HIGH); } while(wave.isplaying); // Wait for startup sound to finish... startPitchShift(); // and start the pitch-shift mode by default. } //////////////////////////////////// LOOP // As written here, the loop function scans a keypad to triggers sounds // (stopping and restarting the voice effect as needed). If all you need // is a couple of buttons, it may be easier to tear this out and start // over with some simple digitalRead() calls. void loop() { uint8_t c, button; // Set current row to LOW logic state... digitalWrite(rows[r], LOW); // ...then examine column buttons for a match... for(c=0; c if(digitalRead(cols[c]) == LOW) { // First match. button = r * sizeof(cols) + c; // Get button index. if(button == prev) { // Same button as before? if(++count >= DEBOUNCE) { // Yes. Held beyond debounce threshold? if(wave.isplaying) wave.stop(); // Stop current WAV (if any) else stopPitchShift(); // or stop voice effect playfile(button); // and play new sound. while(digitalRead(cols[c]) == LOW); // Wait for button release. prev = 255; // Reset debounce values. count = 0; } } else { // Not same button as prior pass. prev = button; // Record new button and count = 0; // restart debounce counter. } } } // Restore current row to HIGH logic state and advance row counter... digitalWrite(rows[r], HIGH); if(++r >= sizeof(rows)) { // If last row scanned... r = 0; // Reset row counter // If no new sounds have been triggered at this point, and if the // pitch-shifter is not running, re-start it... if(!wave.isplaying && !(TIMSK2 & _BV(TOIE2))) startPitchShift(); } } //////////////////////////////////// HELPERS // Open and start playing a WAV file void playfile(int idx) { char filename[13]; (void)sprintf(filename,"%s.wav", sound[idx]); Serial.print("File: "); Serial.println(filename); if(!file.open(root, filename)) { PgmPrint("Couldn't open file "); Serial.print(filename); return; } if(!wave.create(file)) { PgmPrintln("Not a valid WAV"); return; } wave.play(); } //////////////////////////////////// PITCH-SHIFT CODE void startPitchShift() { // Read analog pitch setting before starting audio sampling: int pitch = analogRead(1); Serial.print("Pitch: "); Serial.println(pitch); // Right now the sketch just uses a fixed sound buffer length of // 128 samples. It may be the case that the buffer length should // vary with pitch for better results...further experimentation // is required here. nSamples = 128; //nSamples = F_CPU / 3200 / OCR2A; // ??? //if(nSamples > MAX_SAMPLES) nSamples = MAX_SAMPLES; //else if(nSamples < (XFADE * 2)) nSamples = XFADE * 2; memset(buffer1, 0, nSamples + XFADE); // Clear sample buffers memset(buffer2, 2, nSamples + XFADE); // (set all samples to 512) // WaveHC library already defines a Timer1 interrupt handler. Since we // want to use the stock library and not require a special fork, Timer2 // is used for a sample-playing interrupt here. As it's only an 8-bit // timer, a sizeable prescaler is used (32:1) to generate intervals // spanning the desired range (~4.8 KHz to ~19 KHz, or +/- 1 octave // from the sampling frequency). This does limit the available number // of speed 'steps' in between (about 79 total), but seems enough. TCCR2A = _BV(WGM21) | _BV(WGM20); // Mode 7 (fast PWM), OC2 disconnected TCCR2B = _BV(WGM22) | _BV(CS21) | _BV(CS20); // 32:1 prescale OCR2A = map(pitch, 0, 1023, F_CPU / 32 / (9615 / 2), // Lowest pitch = -1 octave F_CPU / 32 / (9615 * 2)); // Highest pitch = +1 octave // Start up ADC in free-run mode for audio sampling: DIDR0 |= _BV(ADC0D); // Disable digital input buffer on ADC0 ADMUX = ADC_CHANNEL; // Channel sel, right-adj, AREF to 3.3V regulator ADCSRB = 0; // Free-run mode ADCSRA = _BV(ADEN) | // Enable ADC _BV(ADSC) | // Start conversions _BV(ADATE) | // Auto-trigger enable _BV(ADIE) | // Interrupt enable _BV(ADPS2) | // 128:1 prescale... _BV(ADPS1) | // ...yields 125 KHz ADC clock... _BV(ADPS0); // ...13 cycles/conversion = ~9615 Hz TIMSK2 |= _BV(TOIE2); // Enable Timer2 overflow interrupt sei(); // Enable interrupts } void stopPitchShift() { ADCSRA = adc_save; // Disable ADC interrupt and allow normal use TIMSK2 = 0; // Disable Timer2 Interrupt } ISR(ADC_vect, ISR_BLOCK) { // ADC conversion complete // Save old sample from 'in' position to xfade buffer: buffer1[nSamples + xf] = buffer1[in]; buffer2[nSamples + xf] = buffer2[in]; if(++xf >= XFADE) xf = 0; // Store new value in sample buffers: buffer1[in] = ADCL; // MUST read ADCL first! buffer2[in] = ADCH; if(++in >= nSamples) in = 0; } ISR(TIMER2_OVF_vect) { // Playback interrupt uint16_t s; uint8_t w, inv, hi, lo, bit; int o2, i2, pos; // Cross fade around circular buffer 'seam'. if((o2 = (int)out) == (i2 = (int)in)) { // Sample positions coincide. Use cross-fade buffer data directly. pos = nSamples + xf; hi = (buffer2[pos] << 2) | (buffer1[pos] >> 6); // Expand 10-bit data lo = (buffer1[pos] << 2) | buffer2[pos]; // to 12 bits } if((o2 < i2) && (o2 > (i2 - XFADE))) { // Output sample is close to end of input samples. Cross-fade to // avoid click. The shift operations here assume that XFADE is 16; // will need adjustment if that changes. w = in - out; // Weight of sample (1-n) inv = XFADE - w; // Weight of xfade pos = nSamples + ((inv + xf) % XFADE); s = ((buffer2[out] << 8) | buffer1[out]) * w + ((buffer2[pos] << 8) | buffer1[pos]) * inv; hi = s >> 10; // Shift 14 bit result lo = s >> 2; // down to 12 bits } else if (o2 > (i2 + nSamples - XFADE)) { // More cross-fade condition w = in + nSamples - out; inv = XFADE - w; pos = nSamples + ((inv + xf) % XFADE); s = ((buffer2[out] << 8) | buffer1[out]) * w + ((buffer2[pos] << 8) | buffer1[pos]) * inv; hi = s >> 10; // Shift 14 bit result lo = s >> 2; // down to 12 bits } else { // Input and output counters don't coincide -- just use sample directly. hi = (buffer2[out] << 2) | (buffer1[out] >> 6); // Expand 10-bit data lo = (buffer1[out] << 2) | buffer2[out]; // to 12 bits } // Might be possible to tweak 'hi' and 'lo' at this point to achieve // different voice modulations -- robot effect, etc.? DAC_CS_PORT &= ~_BV(DAC_CS); // Select DAC // Clock out 4 bits DAC config (not in loop because it's constant) DAC_DI_PORT &= ~_BV(DAC_DI); // 0 = Select DAC A, unbuffered DAC_CLK_PORT |= _BV(DAC_CLK); DAC_CLK_PORT &= ~_BV(DAC_CLK); DAC_CLK_PORT |= _BV(DAC_CLK); DAC_CLK_PORT &= ~_BV(DAC_CLK); DAC_DI_PORT |= _BV(DAC_DI); // 1X gain, enable = 1 DAC_CLK_PORT |= _BV(DAC_CLK); DAC_CLK_PORT &= ~_BV(DAC_CLK); DAC_CLK_PORT |= _BV(DAC_CLK); DAC_CLK_PORT &= ~_BV(DAC_CLK); for(bit=0x08; bit; bit>>=1) { // Clock out first 4 bits of data if(hi & bit) DAC_DI_PORT |= _BV(DAC_DI); else DAC_DI_PORT &= ~_BV(DAC_DI); DAC_CLK_PORT |= _BV(DAC_CLK); DAC_CLK_PORT &= ~_BV(DAC_CLK); } for(bit=0x80; bit; bit>>=1) { // Clock out last 8 bits of data if(lo & bit) DAC_DI_PORT |= _BV(DAC_DI); else DAC_DI_PORT &= ~_BV(DAC_DI); DAC_CLK_PORT |= _BV(DAC_CLK); DAC_CLK_PORT &= ~_BV(DAC_CLK); } DAC_CS_PORT |= _BV(DAC_CS); // Unselect DAC if(++out >= nSamples) out = 0; } CODE I FOUND FOR IR  ClyonPumpkin That I want to integrate in above   /* * Text-to-speech example to speak the first n digits of pi. * The number is stored in flash, each digit is spoken one at a time. */ #include #include #include SdReader card;    // This object holds the information for the card FatVolume vol;    // This holds the information for the partition on the card FatReader root;   // This holds the information for the volumes root directory FatReader file;   // This object represent the WAV file for a pi digit or period WaveHC wave;      // This is the only wave (audio) object, since we will only play one at a time char eyesound[13]="eye2.wav"; int mute = 0; /* * Define macro to put error messages in flash memory */ #define error(msg) error_P(PSTR(msg)) // IR Remote code int RECV_PIN = 9;  // pin 11 used by SD card interface so select pin 9 for IR IRrecv irrecv(RECV_PIN); decode_results results; long lasttime=0, lastcode=0, timediff=0; //////////////////////////////////// SETUP void setup() {   // set up Serial library at 9600 bps   Serial.begin(9600);               if (!card.init()) {     error("Card init. failed!");   }   if (!vol.init(card)) {     error("No partition!");   }   if (!root.openRoot(vol)) {     error("Couldn't open dir");   }   irrecv.enableIRIn(); // Start the IR receiver } /////////////////////////////////// LOOP void loop() {   if(mute == 0) playcomplete(eyesound);   // check for keypress happened   if (irrecv.decode(&results;)) {      Serial.println(results.value, HEX);      switch (results.value) {        case 0x83228B74:    // 1          playcomplete("command.wav");          break;        case 0x83228F70:    // 2          playcomplete("entertan.wav");          break;        case 0x8322906F:    // 3          playcomplete("extermin.wav");          break;        case 0x83228A75:    // 4          playcomplete("leader.wav");          break;        case 0x8322847B:    // 5          playcomplete("survivor.wav");          break;         case 0x83227887:    // 6          playcomplete("atention.wav");          break;        case 0x8322629D:    // vol up          mute = 0;         // mute off          break;         case 0x83226E91:    // mute          { Serial.println("mute detected");            timediff=millis()-lasttime;            Serial.println(timediff);            if(lastcode!=results.value || (lastcode==results.value && (timediff>1600)) ) {               if( mute == 0 ) { // is mute off?                  Serial.println("toggle off to on");                  mute = 1;      // turn on                  // delay(1000);    // wait a bit for debounce                  break;                 }               if( mute == 1 ) { // is mute on?                  mute = 0;      // turn off                  Serial.println("toggle on to off");                  break;                 }              } // end if             break;           } // end case        } // end switch      lastcode = results.value;      lasttime = millis();      irrecv.resume();   // Receive the next value   } } /////////////////////////////////// HELPERS /* * print error message and halt */ void error_P(const char *str) {   PgmPrint("Error: ");   SerialPrint_P(str);   sdErrorCheck();   while(1); } /* * print error message and halt if SD I/O error */ void sdErrorCheck(void) {   if (!card.errorCode()) return;   PgmPrint("\r\nSD I/O error: ");   Serial.print(card.errorCode(), HEX);   PgmPrint(", ");   Serial.println(card.errorData(), HEX);   while(1); } /* * Play a file and wait for it to complete */ void playcomplete(char *name) {   playfile(name);   while (wave.isplaying);     // see if an error occurred while playing   sdErrorCheck(); } /* * Open and start playing a WAV file */ void playfile(char *name) {   if (wave.isplaying) {// already playing something, so stop it!     wave.stop(); // stop it   }   if (!file.open(root, name)) {     PgmPrintln("Couldn't open file ");     Serial.print(name);     return;   }   if (!wave.create(file)) {     PgmPrintln("Not a valid WAV");     return;   }   // ok time to play!   wave.play(); }

Topic by SithLordIII  


AVR, Variable resistors, USB

Hello everyone,What a great site this is, I've only seen like 50 projects so far and I know there are an incredible large amount still left to discover on the site.. for all of you who write the guides and articles, great job! =)So on to my questions..I'm trying to learn how to build and program a circuit with an AVR uC. Previously I've played with NE555 circuits and I've connected those normal HD44780 LCDs to the LPT port and so on..I've also worked with repairing TV sets earlier, replacing both normal components and SMBs..So I got some basic knowledge of soldering and reading schematics, so thats no problem.However the programming part is more problematic and also how to connect some components to the uC.. My wish to learn is how to connect variable resistors to the uC and connect the uC to a computer (via USB perhaps) and then read the values there and perhaps sending them further to another program.More simple, I want to be able to connect a variable resistor to a uC and then be able to read the value and use that value on the computer..In the long run, what I want to accomplish is a similar piece like the Aurora open source mixer. http://www.auroramixer.com/But first I want to learn how to connect lets say 2-3 variable resistors, which I believe should be connected to the ADC channels on the uC, right? Together with a low value resistor between the variable resistor and the uC, I've got that info from somewhere so I hope I'm on the right track.Ok, so that's quite simple, I guess.. But then, how do I read the values on the uC? I think the uC should poll the ADC pins with a few milliseconds in between, or does it work in some other way? Before I connect it to a PC, a simple way to see if it works would be to send the "value" from the variable resistors to a led for each resistor and increasing or lowering the brightness of the led depending on the value from the resistor.That should be quite simple to rewrite when hooking up the uC to a computer, just forward the info the PC instead of to the led.. or to them both perhaps..What would the code be for doing such?My "problem" as most people think, is that I learn by examples, not by books or pages on the net with advanced explanations.. I need to have it quite simple, even though I have no problem learning new stuff..I've been working with PHP programming for a few years and even though I know its far from PHP in a uC, its still programming so I have some sort of basic thinking, which I hope will be handy somehow =)I've searched through the net, also searched AVR Freaks and I've even asked on the forums of AVR Freaks who tells me, sure you can do that, you just have to start programming.. But I really dont know where to start..I learned PHP by downloading examples, see what they do, change a bit and see what happens and so on.. Sure I can do that with the AVR as well, but there are no examples that even read just one pin with a variable resistor connected.. if I had that I would be able to duplicate and make it read on more pins and so on..I should be able to emulate the code somehow with the AVR developer software, so somehow I should probably be able to emulate a variable resistor and find out what values I get from it.. but I havent been able to get something like that working either..Finally, I'm now writing here cause this page hosts a great load of great guides, from "how to sew your own panties" to "building your own waterbottle rocket".. and because I didnt get that much help from AVR Freaks..so you guys are my last hope, I hope you could help me out..// Chrisps. if someone would be interested in making a guide on how to accomplish this and perhaps even connect the uC over USB to a computer, that would be the best thing ever ;) but I'm not gonna go that far, just some help would be enough.. hehe .ds

Topic by toffie    |  last reply


problem with ethernet udp

Hi im try to set up a simple client server model that allows me to send strings between Python running on PC and the arduino over Ethernet. code of the server side software is: #include //Load Ethernet Library #include //Load the Udp Library #include //Load SPI Library float tempC; //Declare variable for Temp in C float temp; byte mac[] ={ 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED}; //Assign mac address IPAddress ip(192,168,0,252); //Assign the IP Adress unsigned int localPort = 80; // Assign a port to talk over char packetBuffer[UDP_TX_PACKET_MAX_SIZE]; //dimensian a char array to hold our data packet String datReq; //String for our data int packetSize; //Size of the packet EthernetUDP Udp; // Create a UDP Object void setup() { Serial.begin(9600); //Initialize Serial Port Ethernet.begin( mac, ip); //Inialize the Ethernet Udp.begin(localPort); //Initialize Udp delay(1500); //delay } void loop() { packetSize =Udp.parsePacket(); //Reads the packet size       Serial.print(tempC); if(packetSize>0)  //if packetSize is >0, that means someone has sent a request {                         Udp.read(packetBuffer, UDP_TX_PACKET_MAX_SIZE); //Read the data request             String datReq(packetBuffer); //Convert char array packetBuffer into a string called datReq if (datReq =="Temperature")  //Do the following if Temperature is requested     {       temp = analogRead(0); //read analog input on pin A0       tempC = temp * 5.0 * 100.0/1024.0; // ADC to celcius conversion       Udp.beginPacket(Udp.remoteIP(), Udp.remotePort()); //Initialize packet send       Udp.print(tempC); //Send the temperature data       Udp.endPacket(); //End the packet } }   memset(packetBuffer, 0, UDP_TX_PACKET_MAX_SIZE); //clear out the packetBuffer array } code python of the client is: from socket import * import time address = ('192.168.0.252', 80) #define server IP and port client_socket =socket(AF_INET, SOCK_DGRAM) #Set up the Socket client_socket.settimeout(1) #Only wait 1 second for a response while(1):     data = "Temperature" #Set data request to Temperature     client_socket.sendto( data, address) #Send the data request     try:         rec_data, addr = client_socket.recvfrom(2048) #Read response from arduino         temp = float(rec_data) #Convert string rec_data to float temp         print "The Measured Temperature is ", temp, " degrees C." # Print the result     except:         pass     time.sleep(2) #delay before sending next command     print "" please any help when i run the programe nothing happen and i don't no why ???

Question by SoufianeG  


convert any CRT TV or monitor into a vector (XY) monitor?

NOTE: I since found a couple links that might shed some light on the question... From HackIt: New uses for old CRT monitors http://hackaday.com/2008/02/25/hackit-new-uses-for-old-crt-monitors/ It would be very hard to do, but it is possible a CRT could be converted to a vector monitor. Perfect for playing Asteroids, perhaps under MAME. You would have to replace all the control circuits, probably with an FPGA and three ADCs (x/y/intensity). Posted at 8:58 am on Feb 25th, 2008 by MoJo Television and PC monitor experiments http://www.educypedia.be/electronics/televisionexperiments.htm old cga/vga monitor to oscilloscope ? http://www.edaboard.com/ftopic57853.html The inquiry: Maybe I am over-simplifying but I was reading one of those examples of hacking into a CRT's horizontal & vertical yoke controls to sync to music:     http://geektechnique.org/projectlab/707/how-to-make-mac-se30-audio-visualizers and had the idea that it should be possible to create a DIY XY monitor (vector display like on an oscilloscope, Vectrex, Asteroids, etc.) for an Arduino or other uC, MAME or Vectrex emulator, from any TV or CRT, once you have hacked into the electron gun's yokes. My understanding being: Raster display: the horizontal yoke (an electromagnet) sweeps the electron gun from left to right turning on the beam wherever there's a "pixel" at that line (which lights up the phosphor at that point making it visible), then it starts over at the next line (vertical yoke moves down) and draws the next line, and so on, Vector display: instead of rendering a moving image frame-by-frame using top to bottom/left to right scanning, shapes are drawn directly to the screen by positioning the horizontal & vertical yokes at the starting point, the beam turns on, and the yokes repoint to the end point, thus "drawing" the line inbetween the 2 points (I would assume this is for straight lines, not sure if circles or arcs are possible?) then the beam turns off, and the yokes get re-positioned to the next line's starting point. I'm not sure what turns the beam on & off or what kind of timing might be involved, obviously that needs to be controlled somehow. Or for color, where instead of a single white (or green, amber, etc) phosphor exists per pixel, there are multiple (red, green, blue) per pixel, and the beam hits each one at varying strengths (or for a varying length of time?) to 'mix" the primaries to the desired color? I'm not sure how that gets handled in a color vector monitor, but I would assume it's something similar to raster? So if we can hack into a CRT's X/Y yokes and move them around with an audio signal, can we control the yokes more deliberately from a microcontroller to plot specific shapes or text, hence a vector display? For those audio/TV hacks, what is the audio signal doing to the yokes that causes them to move? Whatever it is - voltage, resistance, etc - this is what our device would have to control. Possible proof of concept version: make a device to control the yokes' position etch-a-sketch style with a couple of potentiometers, and turn on the beam with a switch or button. If you see a dot of light moving across the screen then it works. I am thinking the controller might need to be "calibrated" for the individual CRT? (Maybe build some kind of calibration mode into the device.) You might dedicate a microcontroller to driving the display - it could receive text or vector shape coordinates via serial, store the shapes to draw in its own memory, and persist or refresh the image independently, freeing up processing power for whatever device it's displaying for. Another idea would be maybe add some kind of way to read light pen's coordinates, thus making the CRT an input device that can be read from the microcontroller or PC (the Vectrex had a light pen right?)  [This would be a cool mod for the Arduino composite TVout as well.] So is this idea possible without a ridiculous amount of work & parts?  I may be dead wrong about how this stuff works (I'm sure that if this was possible, someone would have done it by now?) but figured it can't hurt** to put the idea out there. I have visions of 4-player vector Arduino pong, Asteroids, Tempest, PDP-1 Spacewar!, vector NES Duck Hunt, a vector etch-a-sketch or lightpen drawing or animation program, or vector Atari Video Music. Possibly an open source color vector games system. Or just a vector display system for any Arduino or microcontroller project, made from any TV. **WARNING: maybe it CAN hurt... Evidently hacking into any CRT can be deadly, you have to discharge the CRT and capacitors properly or you can get killed. So please be careful. This definitely is NOT for kids to try at home.

Question by apple-o    |  last reply


This arduino code does not work as expected, any help? there seems to be an issue with the digitalWrite function. Answered

Recently, I wanted to make a laboratory grade linear semi-precision power supply using an Arduino, LCD, some comparators, and MOSFETs. Idealistically, I want measurements to be 3 significant figures of precision (0.1% accuracy @ 30V), voltages as high as 30V, and max current of 10A. The power supply is most likely going to be just a single regulated output, maybe if I feel lucky I will make 2 regulated outputs once I get the darn Arduino code to work. The Arduino's job is to simply set and read the output voltage, and is not part of the control loop. That is what the comparators are for. (I learned the hard way that using the Arduino within the control loop just results in parasitic oscillations because the Arduino is a clocked device and can only self correct at timed intervals.) Anyway, below is the code. I made explanations of all portions of it as clear as possible, and I also give the wiring used for the LCD, 4 buttons, and analog inputs used to set and read the voltage and current. However, the issue arises when I upload the code, the setVI button does not work unless I press both it and the RS button at same time. I made the many of the integers display in the serial output to diagnosing easier hopefully. I can see the setVI integer and my dudd integer only goes HIGH when  either it and the RS buttons are pressed simultaneously, or when the RS butten is held down for a long enough time. However, as far as I am aware, nowhere in the code do I manipulate that code so setVI goes HIGH dependant on other buttons, so I am bewildered by this parasitic phenomenon. Is my Arduino MEGA broken? I had a similar problem in the past, where I had multiple analogRead statements It strangely seemed to factor in the outputs of other input pins. Anyway, here is the code. Maybe someone could upload it and tell me if it functions properly on their arduino? That would help me determine if it is indeed a software issue. (p.s. I use an Arduino ripoff called the Funduino, but it is not broken in any way, I don't think?) Any and all help would be greatly appreciated, thank you in advance, -Max-. p.s. To make the code below legible, please copy/paste it in an IDE or in notepad and convert it into a monospaced font, it will make it very easy to follow. //---------------------------------------------------------------------------------------------------------------// /* Arduino Software for lab power supply. Wireing guide:        **Wiring for 16x2 LCD:**       * LCD RS pin to digital pin 12       * LCD Enable pin to digital pin 11       * LCD D4 pin to digital pin 5       * LCD D5 pin to digital pin 4       * LCD D6 pin to digital pin 3       * LCD D7 pin to digital pin 2       * LCD R/W pin to ground       * 10K resistor:       * ends to +5V and ground       * wiper to LCD VO pin (pin 3)    **Wiring for buttons:**       * RS       button to pin 6  (as a digital input) -- Switches from reading read current/voltage values to setting those values, and Vice Versa.       * VIselect button to pin 7 (as a digital input) -- Switches to the 'set' mode and flips from setting the voltage to setting the current.       * UP       button to pin 8  (as a digital input) -- Increments the voltage or current up when in the 'set' mode.       * DOWN     button to pin 9  (as a digital input) -- Increments the voltage or current up when in the 'set' mode.    **Analog inputs/outputs:**       *A0   -- Measures a potential of a resistor divider that can output a voltage of 0-5V based on the 0-30V output this PSW capable of.       *A1   -- Measures the current flow through a resistor to measure current. (Some reason there seems to be a pulldown resistor on this pin, so the voltage does not float.)       *Vout -- This will be later implemented if I get a DAC, for the increased resolution. (1024 is just not enough in my opinion. At least 12 bits)       *Aout -- This will be later implemented if I get a DAC, for the increased resolution. (1024 is just not enough in my opinion. At least 12 bits) */ int UP    = 0;      // These are the 2 buttons used to incrementally int DOWN  = 0;      // step up or down the voltage on the output int RS = 0;         // These 2 buttons tell the LCD to either read out the voltage on the analog pins. (I plan to change this so it reads from a 14 bit ADC and writes int setVI = 0;      // the voltage output through a 14 (or 16 bit) bit ADC. I need 3 significant digits, or at least 0.1% accuracy. int dudd = 0;       // this dudd (dummy variable) is just here to prove that digitaslreading pin 7 works very weird! Any help on this? int preRS = 1;      // Anything with a "Pre" before it is simply what said integer/variable on the last loop. I use these to prevent a parasitic int presetVI = 1;   // oscillation of states that they control, so when a button is pressed, it will not jump between 2 states every cycle. int preUP    = 0; int preDOWN  = 0; float Aset = 0.00;  // I need these to be "floated" so I can set the exact value of these to 3 significant digits. float Vset = 0.00;  // Aset and Vset define what the output voltage *should* be, and are defined with the UP/DOWN buttons. int VIselection = 1;// this variable will invert when Aset button is pressed. Similar to the IVselect, this number will also invert int READorSET = 1;  // Bset button is pressed. This allows the mode to be changed from SET mode or the READ output mode, thus allowing                     // one to compare the output voltage and current to the set value, as well as set the output voltage and current. #include LiquidCrystal lcd(12, 11, 5, 4, 3, 2);// initialize the library with the numbers of the interface pins void setup() { //-------------------------// I tried making diagnosting this thing easier by making all the important data availible in the serial monitor.   lcd.begin(16, 2);   Serial.begin(9600);   Serial.print("INPUTS         RS:           READorSET:       setVI & dudd:        VIselection:");   Serial.println(""); } void loop() {   float V = (30.00*analogRead(A0))/1024.00;   //These are what I use to read the voltage output of my power supply. I will have a voltage divider on the output,   float A = (15.000*analogRead(A1))/1024.000; //to limit the voltage range from 0-30V to 0-5V. Same concept goes for the current measurement.   int dudd  = digitalRead(7);//   RS    = digitalRead(6);//RS stands for "Read/set"   setVI = digitalRead(7);//VI is stands for "Current/Voltage set"   UP    = digitalRead(8);//UP is simply a button used to set voltage & current   DOWN  = digitalRead(9);//DOWN is simply a button used to set voltage & current     if(presetVI == LOW && setVI == HIGH){VIselection = -VIselection;}   if(preRS    == LOW && RS    == HIGH){READorSET   =   -READorSET;}     Serial.print("\t        ");  // prints an inital space.     Serial.print(RS);            // prints the RS reading. It should be '1' when pin 7 is HIGH.     Serial.print("\t        ");     Serial.print(READorSET);     // prints the READorSET reading. This should only change when the RS button is pressed.     Serial.print("\t        ");     Serial.print(setVI);         // prints the setVI reading. It should be '1' when pin 7 is HIGH.     Serial.print("\t");     Serial.print(dudd);         // prints the setVI reading. It should be '1' when pin 7 is HIGH.     Serial.print("\t        ");     Serial.println(VIselection); // prints the VIselection reading. This should only change when the setVI button is pressed.         //if(presetVI == LOW && setVI == HIGH && READorSET == 1) {READorSET = -READorSET; VIselect = -VIselect;}      // This line of code just makes so that when I need to go from the voltage read screen to      // the set mode, I can just press the VIselect button. It just makes things more intuitive, but could be      // causeing the error, so I nulled it. I also nulled it out another portion that will keep the voltage or      // current setting the same when using the VI buttton to select the set mode. (otherwise it has to be      // double pressed to return to, say, the current setting, if that is where you left off.)   if(UP == HIGH && DOWN == LOW && VIselection == -1){if(Aset <= 10.00) {Aset += 0.05;}}   if(DOWN == HIGH && UP == LOW && VIselection == -1){if(Aset >= 0.10) {Aset -= 0.05;}}     if(UP == HIGH && DOWN == LOW && VIselection == 1) {if(Vset <= 30.00) {Vset += 0.05;}}   if(DOWN == HIGH && UP == LOW && VIselection == 1) {if(Vset >= 0.05) {Vset -= 0.05;}}     if (RS == HIGH){digitalWrite(13, 1);}   if (RS == LOW){digitalWrite(13, 0);} //============================================================================================================//   if (READorSET == 1){      //this is the defualt screen, and shows the output voltage and current.     lcd.clear();              lcd.setCursor(0, 0);     lcd.print("VOLTAGE:");     lcd.setCursor(0, 1);     lcd.print("CURRENT:");     lcd.setCursor(10, 0);     lcd.print(V);     lcd.setCursor(15, 0);     lcd.print("V");     lcd.setCursor(10, 1);     lcd.print(A);     lcd.setCursor(15, 1);     lcd.print("A");   }   if (READorSET == -1){   // This is the portion of the code allowing me to set the current and voltage     lcd.clear();          // using the up/down buttons.       if (VIselection == -1){         lcd.setCursor(0, 0);         lcd.print("  SET CURRENT:");         lcd.setCursor(5, 1);         lcd.print(Aset);         lcd.print("A ");       }       if(VIselection == 1){         lcd.setCursor(0, 0);         lcd.print("  SET VOLTAGE:");         lcd.setCursor(5, 1);         lcd.print(Vset);         lcd.print("V ");       }   } //============================================================================================================//   presetVI = setVI; // At the end of each loop, the current variable settings that were used are set equal   preRS = RS;       // to the 'pre' versions of the code. This allows me to basically measure the when                     // the button is initially pressed, and/or released. Using this method with the delay()                     // function, however, is a bit buggy, but I did have it working well enough before. If you                     // tap the button too quickly. You almost have to hold it for a split second. If you                     // know a better, simpler way of doing this, please tell me, thank you.                       delay(80);        // The delay helps stabilize the reading on the LCD, but if it is too large, than the                     // refresh rate suffers, and the buttons respond slower. However, setting too low will                     // cause the reading on the display to change so rapidly, it is illegible. }

Question by -max-    |  last reply


Robosapiens india and IIT-G presents

'Short Term Internship Program in Robotics and Embedded 'C' certified by Techniche'09 IIT-Guwahati and robosapiens India.http://www.robosapiensindia.comSTIP or Short Term Internship Program is a career oriented program which gives the participants the opportunity to have a tété-a-tété with the industrial approach to Robotics and Embedded C. It gives you an insight into micro controller and what goes into the making of an embedded system. This duration specific program has been introduced as a result of popular demand from participants of our previous programs.We fell proud to present you with this unique internship variation which will not only change the perception of an internship but will also improve its credibility and efficiency. The course outline is as follows:Course Outline:- • Embedded System Design and Robotics: An Introduction• Microcontrollers & their Architecture• Introduction to Embedded C Programming • Interfacing of peripherals to Microcontrollers • Project Building • Introduction to concepts of RTOSThis course includes the Free Embedded system SDK to all participants.Why this course is a ‘must’?So why should a student go for STIP. We think the following summarizes the plethora of reasons why STIP is a dream for every embedded system and robotics enthusiast:• Embedded System is best understood by applying it in robotics.• Robotics and Embedded systems have a lot of scope in college projects.• The AVR series that we will be using is the most commonly employed series for micro controller at both academic and industrial level.• A participant gets to learn and apply Embedded C programming which is the main programming language for embedded systems with resource constraints. • This is the best way to get to know other robotics enthusiast around the country. • One gets to be in touch with the most talented and experienced professionals in this area of academics and interact with them.STIP benefits in a nutshell:• Exhaustive training with extensive guidance by our panel of experts.• The project based completion of curriculum with both theory classes and hands on sessions.• One can also buy development boards and other robot parts that we’ll use throughout the program.• Certification by IIT Guwahati; Techniche’ 09.• Accommodation facility for participants coming from far away locales.Free Embedded system SDK kit includes :• AVR series microcontroller Based Reserach plateform.• 1 Atmega 16 Microcontroller.• AVR series Universal Programmer.• Connecting cables.• 1 LCD display.• Robosapiens india AVR Loader v1.0 Beta software package.Certification by Techniche'09 IIT-Guwahati and Robosapiens India.Robosapiens India ties up with Techniche'09 India Institute of Technology. All the participants will get a valid Certificate from us.STIP Program cost includes:• Two weeks instructor led exhaustive training.• Two weeks of industry defined, project work.• Take away Embedded system SDK Kit.• Post Training assistance for Project work.• Accommodation assistance.Course Curriculum Details :Embedded System Design: An Introduction Introduction to micro controller is the first step to know about embedded systems. What is a micro controller? What’s inside it? What makes it an embedded system? What are the different families of microcontroller, its derivatives and its applications in industrial projects? Why AVR is the most widely used micro controller family? What goes into designing an embedded system? Its criteria and handling resource constraints.Introduction to Microcontrollers and AVR Architecture This session includes introduction to the AVR series of micro controller, especially ATMega16, which we will be using in our program.Introduction to ATMega16 features viz. • I/O Ports. • Data Registers• Interrupts. • Timer/Counter. • External/Internal clocks• ADC (Analog to Digital Conversion using ATMega16). This session is for familiarization with various functional blocks of the microcontrollers and knowing the inside story of it. Introduction to Embedded C Programming • Embedded C-Programming for Microcontroller. • Introduction to C, Flow control statements, functions. • Data Types, operators and expressions. • Program structures and debugging. • Program Burning and Execution Interfacing of peripherals to Microcontroller(Atmega 16) • Actuators. • Geared DC Motor. • Stepper Motor. • Motor Driver. • Relays. • Solid State Drivers. • Integrated Circuit drivers. Interfacing of various kind of Display devices• Displays. • LED. • LCD. Interfacing various human interface devices with the microcontroller.• Input Devices. • Switches. Interfacing and Study of Sensors to enable microcontroller to acquire environmental data.• Sensors. • Temperature Sensors. • Light Sensors. Project Building and implementation of ideas• Designing• Devlopment• Programming and customizing • Debugging

Topic by meetbajwa