Show Posts
Pages: 1 [2] 3
16  Community / Exhibition / Gallery / Re: Helping visually impaired-universal arduino project on: March 10, 2012, 11:08:55 am
I submitted it to instructables and it got featured. YEEEEEAAAHAAA!
17  Using Arduino / Project Guidance / Re: attiny85-precise timing (maybe with an external crystal?) on: March 03, 2012, 03:15:50 am
Thanks very much. I was able to change the code shortly after I posted. So now it works like charm, it's off by less than minute and it's been running for two days now. My original code was:

Code:
diff=millis()-lastmillis;
          realdiff=round((float)diff/hh)*hh;//round to closest half hour and convert to millis; hh=constant, half hour in milliseconds
          drift=realdiff-diff;
          drift=((float)2/(realdiff/hh))*drift;
          lastmillis=millis();
          int hrz=hour();
          int minz;
          if (minute()>15&&minute()<45)
            minz=30;
          else
          {
            if (minute()>45)
              hrz+=1;
            minz=0;
          }
          setTime(hrz,minz,0,1,1,1);

Now, I managed to avoid fractional math...
Code:
diff=millis()-lastmillis;
          unsigned long compval=hh/2;
          int i;
          for (i=1; i<=10000; i++)//round to closest half hour using different (yet working) method; basically checks how many half hour can fit into "diff" (which is time difference between last and this sync)
          {
            compval+=hh;
            if (diff<=compval)
              break;
          }
          realdiff=i*hh;
          drift=realdiff-diff;
          drift=(2*drift)/(realdiff/hh);
          lastmillis=millis();
          int hrz=hour();
          int minz;
          if (minute()>15&&minute()<45)
            minz=30;
          else
          {
            if (minute()>45)
              hrz+=1;
            minz=0;
          }
          setTime(hrz,minz,0,1,1,1);
18  Using Arduino / Project Guidance / Re: attiny85-precise timing (maybe with an external crystal?) on: February 26, 2012, 12:14:38 pm
Ok, so after numerous days of debugging, I found out what I could know before-integer isn't really the same as float and after you convert it to float, you solve the mysterious problem that has been bugging you for hours-but also exceed progmem by 330bytes with everything optimized to its finest. DAMNIT! Btw thanks for that arduino tiny core you released just hours ago, Coding Badly. Just thinking... Aren't you by any chance aware of any functions of your core that could be made shorter but aren't for sake of code readability or lack of time? Cause that would be a shot in the arm. (I'm also using the attachPcInterruptSimple library, so... yeah.) Now when I think about it, I might be able to convert to integer math only, but that would mean drastically changing the code, I believe.
Edit: My belief was mistaken. Nevermind that.
19  Using Arduino / Project Guidance / Re: attiny85-precise timing (maybe with an external crystal?) on: February 15, 2012, 03:58:10 am
Ok. So first of all, thanks for all your suggestions! But I believe in some cases we might be talking past each other. I probably haven't expressed some things clearly enough, so let me please clarify myself: I'm using the awesome arduino tiny core (Coding Badly: If I get it right, you are the one behind it, so thank you very much, it's awesome). I'm running my chip @1 mhz, because I simply don't need more, so using 20 mhz crystal/oscillator/whatever would be an overkill, furthermore resulting in decreased battery life. I need clock-like accuracy; few minutes a week is ok; quarter an hour a day (with calibrated internal oscillator) is not. So... Yeah, software calibration seems like the way to go. I actually used it before, but thought of it like as of sort of temporary solution to avoid having to set OSCCAL fuses. So thank you very much again! I'm going to implement some sort of calibrating routine. If I run it at :00 or :30 real time, it will round the internal time to nearest half hour, calculate drift and set the offset value. So it'll basically get more precise with every calibration. Then I''l somehow have to solve the voltage and temperature change dependence issues. But that's it so far. Thanks once more.  smiley
20  Using Arduino / Project Guidance / Re: Wireless Drone on: February 14, 2012, 03:18:18 pm
O_O. That's a big task for a beginner. I mean, I wouldn't expect myself to try to cope with it in say next few years. But it might be possible. Google Arducopter.
21  Using Arduino / Project Guidance / attiny85-precise timing (maybe with an external crystal?) on: February 14, 2012, 03:15:49 pm
Hi there, it's me again. I'm building a project (http://arduino.cc/forum/index.php?topic=91474.0) in which I really could use some precise timing. (For measuring time periods longer than 1 hour +-1% is not ok, I'm afraid.) I have two I/O pins free (that's IC pins 1 and 2 counted by standard means clockwise starting from top right) and am now unsure how to proceed. One way would be to buy some external RTC chip. But problem with those is that they need ic2, which seems sort of complicated to me, and furthermore, they are about twice the price of attiny. Another solution would be to use external crystal. However, correct me if I'm wrong, but that would mean: 1) changing fuses (which to me sounds like complete sorcery) 2) my program would run slower, so I'm not sure if I wouldn't run into some timing issues and problems at speed-critical functions, such as tone(). 3) I'm using arduino tiny core and there isn't any option that would say "attiny85 with external crystal at 32.768khz" or whatever. So-does that mean it wouldn't work? I could also get a 1mhz crystal (for which there is an option in the menu) but that would mean I'd lose the advantage of lower power consumption I'd have with watch crystal. Last option I could think of was attaching some sort of timer and letting it interrupt the processor every [known period of time]. But again, 555 timer chip operates on higher voltages than other components do and its power consumption also makes it unsuitable for my project. So... Which way do you think is best? Please, I believe I just need a small hint to get me going. Thanks in advance.  smiley
22  Community / Exhibition / Gallery / Re: Ok a LED Dice - but it's my first Arduino project! - Im proud :) on: February 14, 2012, 07:30:42 am
Wow, that's a nice algorithm you have there. It has the ingeniousness i admire. ( for example: for (byte i=8; i<12; pinMode(i++,OUTPUT)); is a nice one) Makes the code short. Also the idea to use bytes to store the value is pretty neat.
23  Community / Exhibition / Gallery / Re: Helping visually impaired-universal arduino project on: February 14, 2012, 05:16:29 am
Thanks! Well, I've  heard my friends say lot's of jokes of such kind   smiley-grin (Such as: So... You didn't want to put display inside, so you said it's for visually impaired, right? Or: It's for visually impaired because they don't realize how crappy it looks, right? ) xD. Yeah, but anyway, I'm very glad you like it. And hopefully, hackaday will like it, too, although they haven't replied on my mail yet. (I realize there are much more hi-tech devices presented there, yet they featured stuff such as attiny based blinking robot costume or electronic ambient light sensing candle, so they might feature my little thingy, too...) Don't really believe so but I sure hope so.
24  Community / Exhibition / Gallery / Re: Altoids Arduino Webserver using PoE on: February 12, 2012, 03:46:05 am
You just inspired me in terms of what I should use to insulate components from altoids can. I used duckt tape but had problems with it. So thx.
25  Community / Exhibition / Gallery / Re: nimbits 3.3.1 - new search engine, javascript capabilites on: February 11, 2012, 03:12:07 pm
That's cool! I don't have use for it right now, but it surely is an awesome idea!
26  Community / Exhibition / Gallery / Helping visually impaired-universal arduino project on: February 11, 2012, 02:33:57 pm
Hi guys. So I made this universal device for visually impaired. It's clock, stopwatch, egg timer, water level detector and meter. In future, I want to add a color recognizer, sound recorder, calculator, theremin, haptic feedback device and much more. (Rfid tag reader? Thermometer? Compass? (that round one))(But I'll have to upgrade to atmega to achieve such goal.) As for now, all design is build around attiny85 single chip, rotary encoder (multipurpose), two buttons and piezo buzzer. And some recycled parts, such as connectors from old 9v batteries and energit (altoids) can. Overall costs: <5 bucks. Estimated overall costs of sum of (usually single purpose) devices capable of same thing: OVER NINE THOUSAAAAAAAAAAAAAAAAAAAAND!!!! No, seriously, It could get well over 200 bucks. So, yeah. I guess that's it. I might do a tutorial and post codes online if anyone is interested. Based upon previous work: Time.h http://arduino.cc/playground/Code/Time PinChangeInterruptSimple.h and whole core from http://code.google.com/p/arduino-tiny/ and  rafbuff's rotary encoder handling algorhytms. Here's a nice little video:

Sorry about the quality. Dropped my camera on floor, had to use mobile phone.
27  Using Arduino / General Electronics / Re: really dumb question on: February 06, 2012, 11:16:02 am
Hi there. What is that you're trying to achieve? If you want a device that turns on led after you put 2 wires in water, just use a single transistor, like bc547 and appropriate resistors for transistor base and led. Connect emmitor to ground, positive side of led to +, appropriate resistor in series with led, and other wire of this resistor to transistors collector. Than put one "probe wire" directly from + and connect second to base of transistor (you may want to place a small resistor before base of it to prevent damage when short circuiting.) This is known as single transistor amplifier.
28  Using Arduino / Project Guidance / Re: Analogread() on attiny85 (arduino tiny core) problem on: February 05, 2012, 03:19:12 am
Quote from: runaway
I have more questions than answers, goodhen

For analogRead on IC pin2 you have val = analogRead(3); ?
For analogRead on IC pin3 you have val = analogRead(2); ?
For analogRead on IC pin7 you have val = analogRead(1); ?
Is IC pin5 also supposed to be analog input 0?

THX DUDE! THAT'S WHAT I WAS LOOKING FOR! I wrongly assumed that arduino tiny core uses the same pin setup as hi low tech groups solution for porting arduino code to attiny chips. But it didn't. Works now. You're the boss.  smiley-cool

edit: That analog reference thing is so evil! I didn't know it exists and added my own code for gathering analog reference values! GRR!
29  Using Arduino / Project Guidance / Re: Simple project with servos on: February 04, 2012, 02:09:38 pm
I do believe you would want to modify your servo to rotate continuously, otherwise you won't have enough motion to get the curtain anywhere. I've never done this, but this tutorial seems legit. http://www.acroname.com/robotics/info/ideas/continuous/continuous.html
30  Using Arduino / Project Guidance / Re: Controlling 4 Servos Using Keyboard Commands - Mega 2560 !HELP PLEASE! on: February 04, 2012, 02:06:09 pm
Google MaxMsp. I'm not sure, but it might be what you're looking for.
Pages: 1 [2] 3