Is it possible to use a single ATMega16 chip to make a quad thermometer?

Go To Last Post
39 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Today, I made my first AVR project with a lot of help from David Prentice and others on this forum. It's a LM35 based thermometer, output displayed on a 20x4 LCD. The project was a success, all thanks to you wonderful people, and to David for writing me the awesome code.

Now, I want to make a quad thermometer. It will have four LM35 sensors mounted in four different places. Sensors will feed the individual inputs to different pins of an ATMega16 and display all the results on a single 20x4 LCD screen.

Is this even possible with a single IC?

This topic has a solution.

Last Edited: Fri. Apr 24, 2015 - 06:36 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

So you've got a project that takes a single analogue input (from the LM35). Do you thoroughly understand how it does this?

 

Look at the ATMega16 datasheet - what facilities does it have that would support multiple analogue inputs ... ?

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
Last Edited: Fri. Apr 24, 2015 - 06:44 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The built in ADC of ATMega16 can poll the four LM35s in turn, right?

For example, every 0.5 seconds, the ADC polls different sensors in turn.

Possible?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

short yes

But you will get noise on the long wires!

Last Edited: Fri. Apr 24, 2015 - 07:20 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

That's right:

 

ATmega16(L) Datasheet; page 204 wrote:

The ATmega16 features a 10-bit successive approximation ADC. The ADC is connected to an
8-channel Analog Multiplexer which allows 8 single-ended voltage inputs constructed from the
pins of Port A.

 

http://www.atmel.com/Images/doc2...

 

See the diagram on p205.

 

Note that there's a huge number of application notes - many with code - on the 'Documents' tab of the ATMega16 page:

 

http://www.atmel.com/devices/atm...

 

several relate to the ADC...

 

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

sparrow2 wrote:
But you will get noise on the long wires!

Yes - That is the problem with analogue sensors!

 

So it might be time to move to something like the 1-Wire digital sensors:

 

https://www.avrfreaks.net/comment...

 

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yes,   you can read four LM35s.    As Andy said,   long wires are not a good idea for reading Analog sensors.

If you have remote sensors,   you are better off with Digital sensors.   They can read the local temperature.   You have to get this result to your remote AVR.

Most SPI, one-wire or I2C sensors will need additional electronics to handle the long wires.

 

As with every project,   specify some requirements.  e.g. accuracy, length of wires etc.

 

If you are simply measuring 4 temperatures on a single pcb,   you don't need anything extra.

 

I suggest that you write a single readADC(channel) function that returns the ADC value.

And display each channel on a different line of your LCD.

 

Click on the HTML files from Fleury.    This will show you how to use lcd_gotoxy() and other LCD functions.

 

You can poll each temperature in a loop or you could use a Timer to start each ADC conversion.

 

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks so much!

The wires would be pretty long (like 3 metres each), so noise would be a big problem.

Can four DS18S20 be used to feed the digital input to the ATMega16 and display the results directly (without AD conversion?)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi, David!! :)

My project doesn't require too much accuracy. It's used to give a rough idea of temperature of four areas.

But the display is located at the centre while the four areas are at four corners of the room. 3 metres each. Analogs are sufficient or do I need to use DS18S20?

Last Edited: Fri. Apr 24, 2015 - 07:48 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

then just try to put 5 meter wire on the setup you have and see :)

you can filter a lot of readings (for this kind of setup a median filter are the best, so you never get the energy from a spark)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If your environment is full of High Power motors and RF transmitters,   it is rather unwise (tm).

 

If you are in a regular domestic house,   the Analogs might be ok.    e.g. with screened cable.

And you can take multiple readings of the ADC.    Then use the running average.

 

There is no harm in trying something.

I would take multiple readings.   Then analyse the statistical variations.    You will soon see whether your project is practical.

 

Be aware that your fridge compressor can generate 'electrical noise'.   Or a passing motorbike.

 

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Good idea, sparrow, I'll try that in practical situations.

Thanks David for the informative reply. It seems I'm stuck with the pricey digital sensors. Oops. Because I intend to measure the temperature of a compressor motor, the condenser, the evaporator and room temperature. The compressor (0.5HP) would generate a lot of noise, right?

I can shorten the length of wires to 1 metre or somewhat less, by settling for inconvenience; still the money saved by avoiding expensive digital sensors is well worth it.

But the concern is, even if the wire were short, would the compressor interfere?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

bagho wrote:
The wires would be pretty long (like 3 metres each), so noise would be a big problem.

Well, it could be a problem; not necessarily a big problem - possibly not even a significant problem.

 

As noted, good hardware design (screened cables, etc) and software (averaging) will help.

 

Quote:
Can four DS18S20 be used to feed the digital input to the ATMega16

Yes.

 

At 3 metres, just the port pin drive would probably be sufficient.

 

The Atmel code mentioned here https://www.avrfreaks.net/comment... supports up to eight 1-Wire bit-banged links - one on each pin of a port. That would save you having to mess about with addressing individual sensors.

 

See https://www.avrfreaks.net/comment... for key documents regarding 1-Wire.

 

Quote:
and display the results directly

That has nothing to do with the sensor (analogue or digital) - your code has to do that!

 

Quote:
(without AD conversion?)

Yes! The whole point of a digital sensor is that it gives you a digital reading - so nothing analogue to be converted!

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If there are some current (this seems to be powered from the main), it should not be a big problem. (like a 4-20mA connection works fine most places when you don't need speed).

and if you use a median filter spark noise etc.can be avoided.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

It sounds as if you have a wimpy system.    0.5HP looks like a domestic single-phase fridge.

I was expecting an industrial Cold Store.

 

Even if it is domestic,   you want to have quality components.    Even a 0.5HP compressor is expensive.

 

Try with screened cable and software averaging.    Your temperatures are relatively slow changing.     Monitoring the motor currents is more critical.

And I don't think that a LM35 is going to measure -18C.

 

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Rated for Full −55°C to 150°C Range

From Ti datasheet

edit

Add some cheap versions (the letter after the name) are not full range

Last Edited: Fri. Apr 24, 2015 - 09:07 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thank you, Sparrow, for the information on digital sensing.

David, yep, it's a single phase chiller for an aquarium. It's a DIY chiller, so, I need to keep a close watch on its parametres.

The evaporator coil remains around +15C to +20C.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I just broke off a lead of the only LM35 I had, while desoldering it in a hurry. I'll need to wait for a day or two for another LM35 to arrive in the mail, and I'll check it practically by placing it near the compressor, by the Atmega16 thermometer we designed today.

Meanwhile, I'll read up more on the codes and datasheets. :)

EDIT: I have an ammeter monitoring the motor current.

Last Edited: Fri. Apr 24, 2015 - 09:19 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

That's interesting.. Software averaging. Thank you. I guess l do away by reducing the cable length and sacrificing convenience of monitoring. No problem there. But I still worry about the interference created on the compressor motor.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

It is more likely to be noise from the contactor switching in.    And I dread to think what single phase motors do.

 

To read -ve temperatures,  you need a -ve supply.   Look at "FIGURE 2. Full-Range Centigrade Temperature Sensor" on the National data sheet.

 

Over-current can happen quickly.   The motor does not burn out for many seconds or minutes  (e.g. show high temperature).

 

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

david.prentice wrote:
the National data sheet.

National Semiconductor was acquired by TI some time ago...

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thank you, David. Fortunately, the evaporator remains at 15-20C positive. So it wouldn't be a problem, right? :)

I was searching and found a digital DS18B20 at a much cheaper price than expected. I guess we can use digital in this project. Should I order four of them?

Yup, I have an over current protection by a C type 5 Amps MCB. Though it's not that reliable.

I worry about the amount of Freon Charge and fluctuating room temps in the summer and its effect on the compressor. :)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I don't think the noise need be that much of a problem. As we're measuring temperatures here we know that they don't change very fast. So if needs be even the sensor could be completely screened...

 

 

'metal encloser' should, of course, read 'metal enclosure'.

#1 Hardware Problem? https://www.avrfreaks.net/forum/...

#2 Hardware Problem? Read AVR042.

#3 All grounds are not created equal

#4 Have you proved your chip is running at xxMHz?

#5 "If you think you need floating point to solve the problem then you don't understand the problem. If you really do need floating point then you have a problem you do not understand."

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

I am surprised by all the suggestions about noise with analogue circuits

 

Sure analogue readings are susceptible to noise corrupting the results but IME I find that with a good design that very good performance can be had from analogue sensors

 

From my experience with EMC approvals I have seen digital sensors wobble with all kinds, ESD especially however I have yet to see an anlog sensor do this, I never even seen a single thermistor reading that was dubious even in 20V/m fields

 

The design is good, screened cables, filters and common mode chokes

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

That's an extremely helpful diagram. Thank you so much for drawing it.

Now I'm propensed towards analogue LM35. Lolol.

I was wondering if I could make a screened cable from three thin insulated copper cables and cladding it with..err..aluminium foil? I'll enclose the sensor in a metal enclosure like Brian has shown.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

There's no point messing about; do it properly - just use proper screened cable!

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Alright, but the wire, even if it's 1m, would have some 100pf capacitance. Would there be any problem with that?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The capacitance is nothing to worry about.    Your Analog sensor is unlikely to vary at more than 10C per second.   e.g. 100mV / sec.

In fact,   moderate capacitance helps.

 

Yes,   an Analog line is more subject to interference than a digital line.    It is likely to be working at a relatively high impedance.   e.g. 10k.

A digital line is likely to be driven by low impedance output drivers.   e.g. 10R.     And any blip must exceed the thresholds.   e.g. 0.3 * VCC.

 

So a low energy noise blip can get through quite easily.    Bear in mind that the ADC reading depends on the instantaneous voltage on its sample-and-hold capacitor.    A 10mV blip is 1C.   

 

Of course the sample-and-hold is in a very narrow window.    Any noise outside that window is missed.

 

It sounds to me as if bagho is very keen to be a cheapskate.     Buy proper screened cables.    Four 3m lengths are hardly going to break the bank.

If you do end up with sensors that need 100m or 1000m of cable,   a CAT5 cable with RS485 drivers at each end is probably cheaper.

 

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

What is the output drive capability of the lm35? If it will drive a 1K load, then an RC filter with a 10K and a big C right at the sensor will make the temp smooth as a whatever at the end of the long wire.

 

Imagecraft compiler user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

That's a great information that a little capacitance in the wire would actually smoothen down the spikes. Didn't occur to me.

 

David, I'm kind of a cheapskate sometimes.  cheeky  I'll buy properly shielded wires, though. But I guess I can skip the long, 3 metres of wire for the sake of less interference and accuracy. I'll mount the LCD and microcontroller IC near the cooling unit.

 

When I get another LM35 by mail, I'll test how the LM35 works with a metre or so of shielded cable with the compressor running.

 

In the meantime, I'm trying to figure out how to modify this code David has written for me, in order to accommodate 4 sensors polled in turns. My C proramming knowledge has rusted away after college.

 

/*
 * bagho.c
 *
 * Created: 23/04/2015 13:51:50
 *  Author: David Prentice
 */

#include <avr/io.h>             // special function registers
#include <stdio.h>              // sprintf()
#define F_CPU 4000000           // you are running on 4MHz RC
#include <util/delay.h>         // _delay_xx()
#include "lcd.h"                // Fleury LCD library

int main(void)
{
    char display[32], degree = 0xDF;         // special character for degree symbol
    int tempC, tempF;
    ADCSRA = (1<<ADEN)|(7 << ADPS0);        // Enable, div128
    ADMUX = (3 << REFS0)|(1<<ADLAR)|(0<<MUX0);  // VREF=2.56V, 8-bit, channel #0 is on PA0 pin

    lcd_init(LCD_DISP_ON);
    lcd_puts("Temperature is");       // only print this once
    while (1) {
        ADCSRA |= (1<<ADSC);          // Start Conversion
        while (ADCSRA & (1<<ADSC));   // wait for completion

        tempC = ADCH;                 // 10mV per C.  full-scale is 2.56V i.e. 256C
        tempF = (tempC * 9) / 5 + 32;

        sprintf(display, "%3d%cC %3d%cF", tempC, degree, tempF, degree);
        lcd_gotoxy(3, 1);             // 4th column, 2nd line
        lcd_puts(display);            // string is all printed in one go
        _delay_ms(500);
    }
}

 

Last Edited: Fri. Apr 24, 2015 - 08:42 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

David, I was wondering, in the code you've written for me, when we are setting the prescaler for ADC, we are dividing the clock by 128 to get 4 MHz/128= 31.250 KHz for the ADC, right? So, why aren't we using the (1<<ADPS2)|(ADPS1)|(ADPS0) and using (7 << ADPS0)? How are these two similar?

 

Thank you.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'm trying to multiplex two LM35 sensors at first.

 

 I know the code might be wrong in many ways, but am I going the right way? Please guide me.

 

#include <avr/io.h>             // special function registers
#include <stdio.h>              // sprintf()
#define F_CPU 16000000           // 16 MHz clock set
#include <util/delay.h>         // _delay_xx()
#include "lcd.h"                // Fleury LCD library

int main(void)
{
 char display[80], degree = 0xDF;         // special character for degree symbol
 int tempC
 ADCSRA = (1<<ADEN)|(7 << ADPS0);        // Enable, div128, ADC clock at 125 KHz
 ADMUX = (3 << REFS0)|(1<<ADLAR)|(0<<MUX0);  // VREF=2.56V, 8-bit, channel #0 is on PA0 pin

 lcd_init(LCD_DISP_ON);
 lcd_puts("Compressor");          // only print this once
 while (1) {
  ADCSRA |= (1<<ADSC);          // Start Conversion
  while (ADCSRA & (1<<ADSC));   // wait for completion

  tempC = ADCH;                 // 10mV per C.  full-scale is 2.56V i.e. 256C
  

  sprintf(display, "%3d%cC", tempC, degree);
  lcd_gotoxy(2, 1);             // 2nd column, 1st line
  lcd_puts(display);            // string is all printed in one go
  _delay_ms(500);
  
  ADCSRA|=(1<<ADIF);                // Clearing ADC.

   return(ADC);
 }
 
 void Wait()
{
   uint8_t i;
   for(i=0;i<100;i++)
      _delay_loop_2(0);
}

int tempD
 ADCSRA = (1<<ADEN)|(7 << ADPS0);        // Enable, div128, ADC clock at 125 KHz
 ADMUX = (3 << REFS0)|(1<<ADLAR)|(1<<MUX0);  // VREF=2.56V, 8-bit, channel #1 is on PA1 pin

 lcd_puts("Condenser");          
 while (1) {
  ADCSRA |= (1<<ADSC);          // Start Conversion
  while (ADCSRA & (1<<ADSC));   // wait for completion

  tempD = ADCH;                 // 10mV per C.  full-scale is 2.56V i.e. 256C
  

  sprintf(display, "%3d%cC", tempD, degree);
  lcd_gotoxy(2, 2);             // 2nd column, 2nd line
  lcd_puts(display);            // string is all printed in one go
  _delay_ms(500);
  
  ADCSRA|=(1<<ADIF);                // Clearing ADC.

   return(ADC);
 }
 
 void Wait()
{
   uint8_t i;
   for(i=0;i<100;i++)
      _delay_loop_2(0);
}
}

 

Last Edited: Sat. Apr 25, 2015 - 05:18 AM
This reply has been marked as the solution. 
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You are trying to be too complicated.

/*
 * bagho2.c
 *
 * Created: 23/04/2015 13:51:50
 *  Author: David Prentice
 */


#include <avr/io.h>             // special function registers
#include <stdio.h>              // sprintf()
#define F_CPU 4000000           // you are running on 4MHz RC
#include <util/delay.h>         // _delay_xx()
#include "lcd.h"                // Fleury LCD library

int readADC(char channel)
{
    ADMUX = (3 << REFS0)|(1<<ADLAR)|(channel << MUX0);    // VREF=2.56V, 8-bit, channel #0-7 is on PA0-PA7 pins
    _delay_us(10);              // allow multiplexer to settle
    ADCSRA |= (1<<ADSC);        // Start Conversion
    while (ADCSRA & (1<<ADSC)); // wait for completion
    return ADCH;                // 8-bit result because we use ADLAR
}

int main(void)
{
    char display[32], channel = 0, degree = 0xDF;       // special character for degree symbol
    int tempC, tempF;
    ADCSRA = (1<<ADEN)|(7 << ADPS0);        // Enable, div128

    lcd_init(LCD_DISP_ON);
    while (1) {
        tempC = readADC(channel);       // 10mV per C.  full-scale is 2.56V i.e. 256C
        sprintf(display, "channel:%d %3d%cC", channel, tempC, degree);
        lcd_gotoxy(0, channel); // 1st column, N'th line
        lcd_puts(display);      // string is all printed in one go
        _delay_ms(500);
        channel++;
        if (channel >= 4)
            channel = 0;
    }
}

Note that we are still using the 8-bit ADC.   Because the maths works out very easily for a LM35 and a mega16.    (it has a 2.56 VREF)

I suggest that you use the 10-bit ADC.  e.g.

int readADC(char channel)
{
    ADMUX = (3 << REFS0)|(channel << MUX0);    // VREF=2.56V, 10-bit, channel #0-7 is on PA0-PA7 pins
    _delay_us(10);              // allow multiplexer to settle
    ADCSRA |= (1<<ADSC);        // Start Conversion
    while (ADCSRA & (1<<ADSC)); // wait for completion
    return ADCW;                // 10-bit result
}

Ok,   you now read 4x the correct value in Centigrade.   But you can see it change easier.

Most importantly,  you can create a running average and a standard deviation.

 

Go to the shops and buy yourself a pencil.    It will be your best purchase ever!

You can work out for yourself how to display a value divided by 4,  create an average.   Or how to calculate a deviation.   Or anything ...

 

David.

Last Edited: Sat. Apr 25, 2015 - 07:32 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Wow! Wow and triple wow! You know what? You are a mark of true genius! Your program worked like a charm, right off the bat!
 

Now I do not know how to thank you enough for your efforts and help, and for tutoring me all the way. 

 

I'll buy a pencil today and write your programs in my diary, and go through them over and over again to know how stuff works, and then make a code that'd average the ADC in four successive measurements.

 

A few messages with a wise person is worth more than a few years of learning! Oui!

 

 

 

smiley

 

PS: You brought be a step closer to demolish my fears of building an AVR oscilloscope! (I'm a cheapskate, remember? 25,000 INR is too much for an industrial oscilloscope.) wink 

Last Edited: Sat. Apr 25, 2015 - 10:03 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

It must be a generation thing.     A pencil (and eraser) is something that I grew up with.      The most important thing is that you are prepared to write / draw something immediately.     Then think about it,   and make corrections.

 

Somehow a ballpoint is too pemanent.    You avoid writing something if you think that you may have to cross it out later.    No one likes messy writing / drawings.

 

I always reckon that a $10 Saleae clone Logic Analyser is the next best purchase after a box of pencils.

 

If you really need an Oscilloscope,   buy the best that you can afford.    I doubt that a home-made scope will have the accuracy or performance.    Or have a sexy case.    Or fit on a desk / workbench.

 

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

if you want a cheap oscilloscope then use the sound card on a PC

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thank you so much. I couldn't agree more with you on all that! Next thing to do after a pencil is to dig out my books on C programming and brush off the decade-old rust. :)

Logic analyser sounds like an interesting concept indeed.

You're totally right that an AVR oscilloscope would neither be accurate, nor pleasing to the eyes. But I guess, for me, an AVR oscilloscope would suffice. I just plan on building an AVR sinewave inverter, and a rough waveform analysis would be okay. :)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

PC sound card!! Wow that's a cool idea!! Thanks a bunch!! :D

Shall try it today. Would 3V input be too much?

Last Edited: Sat. Apr 25, 2015 - 10:40 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The line in of a sound card can only tolerate 1V, you MUST use a potential divider or other protection to ensure you never apply more than 1V. If you do you may permanently damage a very expensive PC! 

 

In the "recommended freeware" thread in off-topic there is a recommendation of "sound card scope" software to use and the post includes a suggested protection circuit to protect your PC.