Show Posts
Pages: [1] 2
1  Using Arduino / Microcontrollers / Atmega 128 on: May 18, 2011, 07:39:07 am
Hello,

Is there any way I could use Atmega 128 with Arduino? I can solder it to PCB, and attach USB-UART interface.

What bootloader should I use? Are there any supported?
What changes are to be made in Arduino core files - to make it support 128, and make full use of its resources?
2  Using Arduino / Microcontrollers / Re: Cheap External Chip Needed on: May 18, 2011, 07:31:40 am
Is there another type of communication that doesn't use many pins and is well-supported?


I'd recommend I2C. It's not very complicated, uses only 2 lines, and you can work with up to 127 devices simultaneously (various sensors, eeprom etc). With SPI, AFAIK you can use only one device at once (you have to switch them if you have more than one in circuit).
3  Using Arduino / Programming Questions / Re: FreqCounter + PWM problem on: May 06, 2011, 02:14:17 pm
The solution for me was bying another MCU.

Atmega 8, for instance, is $3 only. You can program it to measure frequency, and read data from it via I2C, as I did. And it requires just a couple of elements to make it running: 16MHz crystal, two 22pF capacitors and several wires. Just program the bootloader (optiboot for mega8 works fine), and you can upload sketches simply by inserting it to Arduino Uno.
4  Using Arduino / Microcontrollers / Re: Using blank ATMega 8 with UNO on: March 16, 2011, 10:26:30 am
I've checked it three times, and it is correct.

Did you add 10uF capacitor between RESET and GND to the main board? And what sketch did you use for Arduino ISP? Could you please share it?
5  Using Arduino / Microcontrollers / Re: Using blank ATMega 168 with UNO on: March 16, 2011, 10:09:29 am
Updated: I did not found atmega168 in my local store, so I purchased atmega 8.

I have done everything as it is told, tried both old and optiboot_atmega8 (http://arduino.cc/forum/index.php?topic=52873.0) bootloaders.

However, I get this:
Code:
avrdude: Yikes!  Invalid device signature.
         Double check connections and try again, or use -F to override
         this check.

(I did not forget to select Arduino optiboot8 in IDE.)

Please help me
6  Using Arduino / Microcontrollers / Re: Using blank ATMega 168 with UNO on: March 15, 2011, 11:40:04 pm
Thanks!!
7  Using Arduino / Microcontrollers / Re: Using blank ATMega 168 with UNO on: March 15, 2011, 02:32:40 pm
As that page says,

Quote
NOTE: Currently, you cannot use an Arduino Uno as an ISP programmer because the optiboot bootloader does not support this sketch. A revision for this is in progress.

Do I understand correctly, that, from your experience, it is possible to use UNO as ISP?
8  Using Arduino / Microcontrollers / Using blank ATMega 8 with UNO on: March 15, 2011, 12:14:38 pm
Hello,

I have an empty 168, without any bootloaders. I want to use it with Arduino UNO (in fact, I am going to put that 168 later to standalone circuit, but first I need to use it with uno - to program it).

I want to burn a bootloader into it. What do I have to do?
My friend has a uC programmer. I assume I should give him hex file (which one exactly), and fuses? (I'll be using ext.16MHz crystal)
Which one bootloader (optiboot-diecimilia or old one) would you recommend?

Thanks in advance
9  Using Arduino / Networking, Protocols, and Devices / Re: Interfacing M24C02 EEPROM on: March 11, 2011, 09:52:10 am
Well, I have created an article on HH10D. It is here:

http://tushev.org/articles/electronics/46-interfacing-hh10d-with-arduino



As for footprint, the project I'm working on uses a lot of float calculations, so this will not reduce it. But thanks for an advice for future!
10  Using Arduino / Networking, Protocols, and Devices / Re: Interfacing M24C02 EEPROM on: March 08, 2011, 03:58:18 am
Almost... However, today I'll do some tests to say that for sure.

As for optimization, thanks for an advice! * should be faster than /, and I'll include that to my final release...
11  Using Arduino / Networking, Protocols, and Devices / Re: Interfacing M24C02 EEPROM on: March 07, 2011, 03:56:00 pm
Sure I will - or even I will create a library for HH100D.
However, I'm still rewriting the code... (there's another problem, but I almost solved it - http://arduino.cc/forum/index.php?topic=54611.new). As soon as I finalize it, I will publish the code.

As for reading calibration values, I did that only once. Then I use them hard-coded in my project (because I'm not going to change the sensor), like:
Code:
RH = (7746-freq)*370/4096;
I've even disconnected the sensor from I2C.

As I understand, neither offset nor sensitivity will exceed the range of [0;10000].
12  Using Arduino / Programming Questions / Re: FreqCounter + PWM problem on: March 07, 2011, 03:36:35 pm
Thanks johnwasser!

Yes, it's a square wave.
I've dediced to use pulseIn() at last. The problem is that it does not provide accurate results: for a frequency of 7430 Hz it shows something like 7920 on HIGH, and 7168 on LOW. (Despite I collect 1024 samples and use average as a reading).
However, LOW seems more stable, so I remembered my Metrology lectures, collected a large number of readings from both pulseIn and FreqCounter, and it defined some regions with linear corrections (for instance, if f is in [7100;7200] I add 260 to pulseIn value etc...)
This resulted in ~3% accuracy (average about -0,4% humidity), but together with sensor 3% this produces accuracy of about 6% (humidity)

So the problem is solved - in a part for sensor readings (although they are not as accurate as I wish).
See here: http://tushev.org/articles/electronics/45-compensating-the-difference-between-freqcounter-and-pulsein-measurements
However, I'm still wondering, if there's a way to undo changes that FreqCounter does to PWM's?
13  Using Arduino / Programming Questions / Re: FreqCounter + PWM problem on: March 07, 2011, 11:13:18 am
Yes, it's Timer/Counter1/ I noticed that PWM's on pins 11 and 3 are not affected. But this is not enough for me! I need at least 3 pwm outputs!


Any ideas?

Is it possible to reset TC1 to initial state after measurement?
14  Using Arduino / Programming Questions / FreqCounter + PWM problem on: March 07, 2011, 08:53:40 am
Hello!

I'm developing a project with Arduino, which includes measuring frequency (an output from humidity sensor), and also managing RGB light. I use PWM at pins 9,10,11 for R,G,B channels.
When my sketch starts, everything's ok. But a few seconds later, after FreqCounter is called, PWM output on pins 9,10,11 changes - from the color of the backlight I guess that its duty cycle increases(the colours shift to more intense ones, i.e. orange->red etc), but this is only a guess.

Here are parts of code that are responsible for this:

Code:
void updateHumidity(boolean force){
  if(!force){ //if not forced to update
    if (blOn || millis()-lastHumScan<HM_TIMEOUT) return; //do not do it while backlight is on or too often
  }
  FreqCounter::f_comp= 8;             // Set compensation to 12
  FreqCounter::start(1000);            // Start counting with gatetime of 1000ms
  while (FreqCounter::f_ready == 0)         // wait until counter ready
      freq=FreqCounter::f_freq;            // read result
  lastHumScan = millis();
  lcd.setCursor(8,1);lcd.print(freq);
}
void backLight(){
  if(bldTick==0 || (millis()-bldTick<BL_TIMEOUT)){
      analogWrite(9,r);
      analogWrite(10,g);
      analogWrite(11,b);
      blOn=true;
  } else {
      analogWrite(9,0);
      analogWrite(10,0);
      analogWrite(11,0);
      blOn=false;
  }
}

I use Arduino Uno.
The frequency range is about 5-10 kHz, and most often I get 7.5 kHz.


Could you please help me with this? Is there way to return PWM outputs to normal after freq.measurement? Both true colours and frequency measurement are very important to my project.
Or should I use another pins, not controlled by Timer1?

Thanks!
15  Using Arduino / Networking, Protocols, and Devices / Re: Interfacing M24C02 EEPROM on: March 06, 2011, 01:07:28 pm
Many thanks robtillaart, it worked!!!

As for code, that's what I have:

Code:
void updateHumidity(boolean force){

  FreqCounter::f_comp= 8;             // Set compensation to 12
  FreqCounter::start(1000);            // Start counting with gatetime of 1000ms
  while (FreqCounter::f_ready == 0)         // wait until counter ready
      freq=FreqCounter::f_freq;            // read result
 
  int sens = readSensitivity(81);
  int offset = readOffset(81);

  int RH = (offset-freq)*sens/4096;

  lcd.setCursor(0,1);lcd.print(RH);

}
+ your functions

The only difference is that device address is 81. I first tried 1, as specified in HH100D datasheet, and it did not work. Then I looked through M24C02 datasheet, and found that in my case it should be b1010 001 = d81.

For my sensor, offset = 7746 and sensitivity = 370.
By the way, the sensor works fine without any logic-level converter(sensor is 3.3v and arduino is 5v). I added 4k7 pullup resistors from +3.3v.

Thanks again!!!
Pages: [1] 2