Show Posts
Pages: [1] 2 3 ... 7
1  Using Arduino / Project Guidance / Re: MCP1640 boost regulator outputting 8 volts?! on: June 21, 2014, 08:54:33 am
So it has been working a treat, no problems whatsoever. Now I have tried to measure the battery voltage using a multimeter. It froze and I can't get it to work again. The built-in debug shows RTC communication error. Then it freezes. I have no idea what the hay is going on. .-.

Using the multimeter caused this?  smiley-eek-blue

Yea, but no worries. I was probing it using a scope and it fixed it. Apparently nothing to worry about... Or is there.
2  Using Arduino / Project Guidance / Re: MCP1640 boost regulator outputting 8 volts?! on: June 20, 2014, 01:30:19 pm
Wow, good concept, nice project, obviously a lot of effort over some time. Thanks for sharing. Hadn't heard the line about the best watches being the fastest, haha!

So it has been working a treat, no problems whatsoever. Now I have tried to measure the battery voltage using a multimeter. It froze and I can't get it to work again. The built-in debug shows RTC communication error. Then it freezes. I have no idea what the hay is going on. .-.
3  Using Arduino / Project Guidance / Re: audio + ir + phone = ir remote on: June 13, 2014, 02:57:07 pm
ThNks thegoodhen.
I saw that if you use stereo audio,such as having onemled to the right channel and one led to the left channel, then the max frequency of your phone basically double to a potential of 40.1khz.
But id rarher stick to the 1 led i hav because it is simpler to comunicate with the arduino.
Is there any way i can work around this problem, such as still using one led but beingle able to increase the frequency some how?
If not thats fine.

That might be possible, not sure about that. However, even if that's the case, I am not even sure about the 20khz bandwidth in the first place.

However, there are other ways.

Instead of using this thingy, you can use Arduino. Super cheap clones are available on Ebay.

Chinduino is about $12; this being said, I would hardly recommend using Arduino in a finished product.
Have you considered using something like attiny85? You can program it directly from the Arduino and it's cheap.
4  Using Arduino / Project Guidance / Re: audio + ir + phone = ir remote on: June 13, 2014, 05:28:31 am
Alright so i ordered all the parts and tommorkw im going out to radioshack to buy the rest of the components.
so if the transmitter and reciever are made correctly and work, then i will be set to communicate with the arduino from my phone, which is awesome.
From there i will work up to tranmitting to the tv.
Thanks for the help and bearing with me thru all my mistakes and questions!

Amplifiers have what's called a gain bandwidth product. Their UNITY gain bandwidth product determines at which frequency can the gain be at least unity (=1).
The gain determines how many times is the output signal amplified. Gain of 2=Output=2x input, etc.
Gain is usually expressed in dbs. This has many pros, but can be a "trap for young players". Check EEVBlog db explanation on youtube. (If you wan't to; I don't think you need to.)


The higher the frequency is, the lower can the gain be. However, you don't need that much of a gain anyway, so it should work just fine.

From there i will work up to tranmitting to the tv.
Thanks for the help and bearing with me thru all my mistakes and questions!

However, it will most likely not be possible to control your TV with your phone. Not using this setup, sorry.
You'd need a 38khz signal; the highest frequency your mobile phone can output will be around 16-20khz.
5  Using Arduino / Project Guidance / Re: audio + ir + phone = ir remote on: June 12, 2014, 03:32:02 am
Alright, i am making a parts list now and will get them some time this week, in the meantime i will familiarize myself a lil mkre with frequency modulation.
Thanks!

Okay; Here is the preferred order of actions you should go with which will make your life easier

1) make your IR LED light up and check if your Arduino can register that by writing a sketch that lights up the pin 13 LED whenever the phototransistor opens
2) build the transciever circuit; test it with a low frequency audio file (1hz?)-btw of course it blinks once a second-that's what 1Hz means. Once a second. 2Hz=twice a second. 2Mhz=2 000 000 times per second.
3) set it to some low, yet higher frequency; 400Hz or so
4) try to measure this frequency using your Arduino; write down how much off it is;
5) experiment with different frequencies up to say 20Khz
6) use the code snippet I've sent here to decide what to do based on the frequency
7) done
6  Using Arduino / Project Guidance / Re: audio + ir + phone = ir remote on: June 11, 2014, 03:04:59 pm
Thanks goodhen!
No disrespect to you at all, i just want to make sure of things, @raschemmel, does this sound good.
I just want two opinions on it.
So i think i will go with the 2nd circuit, and i will use the lm358.
 I got audacity. So i believe that if what goodhen is saying is right then all i need to do is make wav files with audacity by making a tone using a square wave. Then i make a wav file containing a tone at 1hz and and then another at 2hz and so on so forth correct?
Its a learning process for me espcially in this area,
Thanks!

I've edited my previous post;
I believe it's a typo, but you don't want 1 hz. You want 100hz or 1 khz.
7  Using Arduino / Project Guidance / Re: audio + ir + phone = ir remote on: June 11, 2014, 02:50:51 pm
would it be possible to detect two SIMULTANEOUS IR LIGHT BEAM frequencies ?

Nah, probably not. But... is it really necessary? He needs to make an IR remote. Those typically have only one LED.
Sorry if I've missed anything.

I believe that doing it my way makes both the encoding (creating the wav file) and decoding process very easy.
Furthermore, it's frequency modulated by definition, and as such less prone to interference [citation needed].
"Real" IR systems often use some sort of modulation, typically 38khz or so.

The bandwidth could be about 20Khz, I wouldn't go higher than that. Even if the frequencies were 1 Khz apart, that leaves you with 20 commands to use. You could measure the frequency for 1/10 of a second, to get 1/10 of the actual frequency. Such resolution would suffice. I would first determine how many commands I need.  (15) Then I'd add a bit of an overhead. (20).
Then I'd evenly distribute them across the spectrum. (1khz, 2 khz...). Once I run out of places (I'm at 20 khz), I'd go in between. (1.5 khz, 2.5 khz...); then in between those; etc. I'd say having up to 250 (256 for round number) commands would be completely feasible.





MY WAY:
PROS:

-Easier to implement-both encoding and decoding-matter of a few clicks to generate the wav file+I've pretty much shown the whole code here (you'd need to edit it to fit your needs)
-Would probably work better with lossy formats(?)-the mp3 gets rid of some data; this would need to be taken into account when designing the protocol thingy


CONS
-doesn't support data streaming; you are limited to just sending commands
-doesn't work with multiple LEDs

Raschemmels way:

PROS:
-could probably be modified to stream data
-could have more commands; however, I don't believe the limits with my methods are... limiting

CONS:
-hard(er?) to implement on both sides (some sort of 0 wire interface, perhaps?) (haha, get it? wireless 1 wire=0 wire... nevermind); would need a carrier waveform anyway for the sake of interference prone-ness.
8  Using Arduino / Project Guidance / Re: Endurance on: June 11, 2014, 01:50:35 pm
I am going to run code in arduino board continuously for 3 months. Do you think it can stand it without affecting intended functionality?



Quote from: Atmega_datasheet
– Data retention: 20 years at 85°C/100 years at 25°C(1)


Reliability Qualification results show that the projected data retention failure rate is much less
than 1 PPM over 20 years at 85°C or 100 years at 25°C.

As long as it's not in space... If it is, make sure to wrap it around with a lot of aluminium foil. My biggest concern would be the on-board regulator.

I've had an AVR chip run continuously for about 4 years; it's not a problem. Humidity, temperature, vibrations-this will all affect the reliability of the device. Make sure your input voltage isn't too high; 9 volts is about it, excess energy gets converted into heat when it's not powered from USB. Even if you put it high, it will still be okay. 3 months is not an issue.
9  Using Arduino / Project Guidance / Re: audio + ir + phone = ir remote on: June 11, 2014, 01:34:13 pm
Ok so for the transmitting circuit i have a choice between these, see attatchments. Is that correct?

If I understand it correctly, one is using opamp as a comparator, the other as a regular opamp.

If used as a comparator, the opamp will only switch the output to the extremes (almost 0v or almost its supply voltage), depending on which one of the inputs is higher.

If used in a feedback loop, it will try to always keep its input nodes on the same level by adjusting its output. if you were to just connect the output to the negative input, the output would always (given the correct operation, etc.) on the same level as the positive input. By placing a voltage divider either in the feedback loop (between output and (typically negative) input) or on one of the inputs, you can achieve either an amplification or an attenuation.

In other words, the one with the feedback loop will amplify the input voltage, preserving the input waveform, while the comparator one will give you a squarewave output, no matter how the input waveform looks.

It only matters a little which way you decide to go, since a) the wav will already have a squarewave in it and b) the Arduino side will only detect LOW and HIGH anyway.
10  Using Arduino / Project Guidance / Re: audio + ir + phone = ir remote on: June 11, 2014, 09:44:12 am
Ill look at audacity
The only thing i guess I dont understand is what will turn the led on all the way and what will turn it off all the way, once i get that down i can just do sequences of on and off right.
A tv remote works where the ir led blinks on and off rapidly but every button kon the remote is a different sequence of blinking correct?

I am not sure if I understand. Well, it's fully off when it's at 0 volts (well, if it's a bit below the Vdrop of the LED)  and fully of when at the max line in. The amplitude of the max thingy depends on the volume and also on the line voltage. The square wave goes between those extremes.
If you use a comparator, like Raschel suggested, it will suddenly turn the LED on once the input reaches certain threshold and turn it off once it goes below it.
11  Using Arduino / Project Guidance / Re: audio + ir + phone = ir remote on: June 11, 2014, 03:53:26 am
Quote
He will not get any special treatment because of his age. He posted voluntarily , he can accept the fact that he will be treated equally like any other poster.

I was under the impression that he does get a "special treatment because of his age"-in a negative sense of word.

If you treat others the same way too, no matter what their age is... not as bad in my book.

I mainly just wanted to point out you weren't being nice as a feedback-I wasn't sure if you were realizing that. Once more, I do value your expertise and the amount of help you provide to those in need here. Don't take it as a diss, I meant no disrespect.
-----------------------------------------------
About the frequency measurement...

A while ago, I was messing around with frequency measurement. This code is far from perfect, it may be a bit buggy, and it's not well commented. It's something I've put together based on the datasheets just for my personal use, as an experiment.

If I recall it correctly, however, it works.

Connect  pins 3 and 5 of your Arduino with a resistor. 1k or 10k or thereabouts is fine. it will display the pwm frequency over the serial port. it measures the frequency on pin 3-T0.

Code:
#include <util/delay.h>

void setup() {
  // put your setup code here, to run once:
  //reset our counter
  resetCounter();
  TCCR1A = 0;
  TCCR1B|=(1<<CS10)|(1<<CS11)|(1<<CS12);//clock on rising edge
  OCR1A=65500;
  
  TIMSK0 &= ~_BV(TOIE0);
  
  pinMode(3,OUTPUT);
  pinMode(5,INPUT);
  analogWrite(3,128);
  Serial.begin(9600);

}

void loop() {
  // put your main code here, to run repeatedly:

  //resetCounter;


  Serial.println(measureFrequency());



}

unsigned int measureFrequency()

{
 // cli();
  unsigned int count1=0;
  unsigned int count2=0;
  unsigned int countDiff=0;
  count1 = TCNT1L;
  count1 |= (TCNT1H << 8);
  _delay_ms(1000);
  count2 = TCNT1L;
  count2 |= (TCNT1H << 8);
  if (count2<count1)
  {
    countDiff=0;
  }
  else
  {
    countDiff=count2-count1;
  }
 // sei();
  return countDiff;
}

void resetCounter()
{
  TCNT1H=0b00000000;
  TCNT1L=0b00000000;
  // count=0;
}





And do you have a suggestion on what software i can use to creat the square wave and wav file?

As I said, Audacity should do the trick and it's free. Generate->tone
waveform:Square

File->export

As to deciding what to do based on the registered frequency, I'd do something along these lines:
Code:
#define FREQ_SOMETHING 100
#define FREQ_SOMETHINGELSE 200
#define FREQ_ANOTHERSUMTIN 300
#define NUMBER_OF_FREQS 3
#define MAX_FREQ_DEVIATION 5

int frequencies[NUMBER_OF_FREQS]={FREQ_SOMETHING, FREQ_SOMETHINGELSE, FREQ_ANOTHERSUMTIN};

(...)
int returnMatch()
{
  int measuredFreq=measureFrequency();
  int difference=0;
  int minDifference=10000;
  int closestMatch=-1;
  for (int i=0;i<NUMBER_OF_FREQS;i++)
  {
    difference=abs(measuredFreq-frequencies[i]);
    if (difference<minDifference)
    {
      minDifference=difference;
      closestMatch=i;
    }
  }
if (minDifference<=MAX_FREQ_DEVIATION)
    {
      return closestMatch;
    }
else
   {
      return -1;
   }
}

All you have to do when you decide to change the number of frequencies (or corresponding actions) is to change the
NUMBER_OF_FREQS define and the array. Code will do the rest up to the maximum amount of frequencies dictated by audio bandwidth and frequency measure resolution (pretty darn high-you may want to increase or decrease the MAX_FREQ_DEVIATION define. It indicates how far can the measured frequency be from the desired one while still registering as such. If you put it too high, it will reduce how close can 2 freqs be to each other. If you put it too low, it may not work, I'd say 5 is good.).
12  Using Arduino / Project Guidance / Re: audio + ir + phone = ir remote on: June 10, 2014, 01:05:32 pm
No hehelped me out alot i just took it the wrong way
And thanks for the audacity. Ill look into it.
I am actually gonna end up using a 3.5mm jack that has a 4 prong jack, i guess it has a speakerand mic in it because of the 4 rings.
Which rings would i connect the led to?


That jack of yours sure loogs ugly.

Here is a wiring diagram, didn't have chance to check its correctness.
http://www.wiringdiagrams21.com/wp-content/uploads/2010/11/3.5mmHeadphoneJackSchematicDiagram.jpg

I did compliment him on his schematic .... smiley-lol

*sigh* Thanks for the hard work though.

13  Using Arduino / Project Guidance / Re: audio + ir + phone = ir remote on: June 10, 2014, 12:38:24 pm
Ok thanks
Ill see what i can do.
Ill Keep you posted.

You could probably use some sort of frequency modulation.

I'd say-get a program that can generate a square wave of certain frequency into wav. Audacity is free and can do just that.
Then send it over your 3.5 jack. It should be powerful enough. IR draws a little power, since power is inverse dependent (or however it's called) on frequency. Then measure the frequency by Arduino. Simple, but should work, I guess.  
Harsh ? I didn't mean to be harsh. What did I say  that sounded harsh ?
I'll look at the links. Nice schematic BTW....

Like... everywhere. Sorry, but there is no need for snarky comments just because he is 15 year old. It's intimidating.
I do however see and appreciate the time you used to help him and your expertise. Just saying. But take a look-he even put a diode across that relay. That is something that is often omitted by even 25 year olds. He is pretty damn smart and has all the bragging rights.
14  Using Arduino / Project Guidance / Re: Detect the status of an exhaust fan on: June 10, 2014, 03:56:48 am
Could I use the code here http://www.pyroelectro.com/tutorials/tachometer_rpm_arduino/software.html for the IR reflective sensor? I want to measure RPM like this (http://www.stumbleupon.com/su/9XvNYO/embedded-lab.com/blog?p=2425) but the site used a different controller. Also, could you suggest an IR module from sparkfun that I could use for this project?

As I said-

It could work with the first one, too. It's just a matter of how reflective the surface is. It needs to be so reflective that the bounced
Quote from: me
light is intense enough to register as logic level. I doubt using the adc is an option-it's too slow for this purpose. Using an opamp (or a transistor) would be pretty simple if the light levels are too low.

I have never bought anything from Sparkfun and have never done this before, either (actually, I've done stuff with beam interrupt for rpm measuring, but not with reflective surfaces). I don't wanna recommend something that might not work.
15  Development / Other Software Development / Attiny84-measuring its own Vcc on: June 09, 2014, 09:19:43 am
Hello. I've been designing a product and wanted to do a selfcheck on poweron. So I needed a way, among other things, to check the VCC (I am using a DC/DC convertor-need to check if it works fine.)

I've modified code from here:

https://code.google.com/p/tinkerit/wiki/SecretVoltmeter


For it to work on attiny84:

Code:
long readVcc() {
  long result;
  // Read 1.1V reference against AVcc
  ADMUX =  0b00100001;// adc source=1.1 ref; adc ref (base for the 1023 maximum)=Vcc
  delay(2); // Wait for Vref to settle
  ADCSRA |= 1<<ADSC; // Convert
  while (bit_is_set(ADCSRA,ADSC));
  result = ADCL;
  result |= ADCH<<8;
  result = 1126400L / result; // Back-calculate AVcc in mV
  return result;
}


5 mins of work, I know-but you guys might find it useful, since it's a bit of a "hidden" feature. So yea, mostly pointing out it's possible, since on the page I linked to it says it works only on atmega 168 and 328.
Pages: [1] 2 3 ... 7