Show Posts
|
|
Pages: 1 [2] 3 4 ... 28
|
|
16
|
Using Arduino / Programming Questions / How often to write to EEPROM
|
on: February 20, 2013, 02:11:16 am
|
|
I will be using the EEPROM to store distance and time for a bike speedometer, and load them at startup in case of switching off. But switching off may not have a warning. These values will change just about every second, or even more at times. Is it safe/recommended to write to the EEPROM that often? Is there a finite amount of times it can be written to before failing? Should I limit it to writing only when the rider has stopped, so maybe once every few minutes? If it makes any difference I am storing two longs split up into the first 8 bytes of the EEPROM.
A second side question: If I plan to use power down sleep mode a lot, can I trust my variables to stay in tact or should I read from the EEPROM when waking from power down? I suppose if that was a problem, I would have bigger problems to worry about so I would assume that is not necessary.
Thanks
|
|
|
|
|
17
|
Using Arduino / Programming Questions / Re: Why does Power Down not work here?
|
on: February 19, 2013, 08:00:22 pm
|
|
Ah, ok my problem first was that I didn't realize I was using "IDLE" so I wasn't getting the multimeter readings I was expecting. Then I added the serial out to double check and like you said, that doesn't work. I changed it to power down and everything it behaving now. Thanks.
|
|
|
|
|
18
|
Using Arduino / Programming Questions / Why does Power Down not work here?
|
on: February 19, 2013, 07:14:47 pm
|
#include <avr/sleep.h>
void setup(){ // disable ADC ADCSRA = 0; pinMode(2,INPUT); attachInterrupt (0, gotoSleep, RISING); Serial.begin(9600); Serial.println("reset"); }
void loop(){
}
void gotoSleep(){ Serial.println("gotoSleep"); detachInterrupt (0); attachInterrupt (0, wake, RISING); set_sleep_mode (SLEEP_MODE_IDLE); sleep_enable(); sleep_cpu (); detachInterrupt (0); attachInterrupt (0, gotoSleep, RISING); }
void wake(){ Serial.println("wake"); sleep_disable(); } This simply doesn't work for me and I don't know why. After "reset", serial wont print anything. I have a multimeter hooked up to it so I know it's not going to sleep. I can get it to sleep fine if I put the sleep stuff in the setup. But if I comment out all of the sleep and interrupt lines in the gotoSleep function, it calls gotoSleep just fine when I press the button. I must be missing something very obvious.
|
|
|
|
|
20
|
Using Arduino / Project Guidance / Re: Soft switch
|
on: February 17, 2013, 11:54:59 pm
|
Read the datasheet on the cpu for insight on lowering the sleep current more. You may wish to power down some internal features before going to sleep.
I'll take a look. Edit: I'm using avr/sleep.h and avr/power.h to call "SLEEP_MODE_PWR_DOWN". I thought that powered down the most stuff. Maybe I'm missing something, but how do you get the ATmega to read an input when it doesn't have a ground connection?
It wouldn't be doing anything until the switch cause the NPN to saturate, then the arduino set the output to high, keeping it saturated when the button isn't pushed anymore.
|
|
|
|
|
21
|
Using Arduino / Project Guidance / Soft switch
|
on: February 17, 2013, 10:54:12 pm
|
|
I've got an ATmega328 running off 3v at 8MHz. I'm hoping to get my project powering on and off from a tactile button that will also have functions during the program. I also have limited space left on my board so I'm trying to keep the number of components low. I came up with this circuit and was hoping that it, or something similar might work. I've been trying it out (not the input part yet) and found two issues. First, it takes about 3 seconds for the arduino to set the pin high and keep it on with the pin being set high in startup. Second, it seems to stop working when I go from 3.3 to <3v from the cr3032 battery.
Using the power down function only brings me down to 0.17mA which only gives me about 40 days of "standby time." I'm hoping there's some way to get my circuit to work.
|
|
|
|
|
22
|
Using Arduino / Project Guidance / Re: best way to sense someone entering a room
|
on: February 03, 2013, 11:31:21 pm
|
|
Yes there are some issue with PIR. It's only going to tell you if someone in front of it is moving. You can't just point it at the room and count the people. PIR would be easy if you just want to know if someone is in there or not. But to count people going in you are going to need to set it up someway just as you would a trip laser or something. a PIR sensor still isn't going to tell the difference between one or two people.
So you need to figure out these things: -Is there more than one entry to the room? -Is it possible for more than one person to enter it at a time, or for them to be so close that conditions don't change between them. -Do you need to know if someone is leaving? Can they leave out the same way they came? Can someone be leaving while someone else is entering? -Is it okay to occasionally have errors due to people leaving/entering at the same time?
Basically if you can't control all of these conditions you're going to have some trouble unless you are okay with the occasional error. If you can't get people in and out one at a time per door, you can't really tell exactly whats going on. You would either need video recognition, or enough of those pads to have a high enough resolution to actually see where people are stepping.
If you can control how people enter and leave the room, or you are ok with these errors then just get two trip lasers or two sonar sensors. The two sensors are set up so that as you walk in, you pass one, then the other. If sensor 1 detects something, then sensor 2, someone has walked in. If sensor 2 then sensor 1, someone has walked out. I wouldn't do this with PIR sensors because they detect change so they will bounce around when someone walks in front, then when someone walks away. Both send the same signal, "hey something changed.... hey something changed again, maybe someone is there, maybe not." Whereas with a sonar you can see "something is 6 ft away... ok something is 1 ft away... ok something is 6ft away again" you know that someone just walked by. Plus PIR will bounce around multiple times per change anyway, they are really only any good if you just want to know if someone is around, not anything with accuracy like this.
|
|
|
|
|
23
|
Using Arduino / Project Guidance / Re: Need to build a rotating mirror like this
|
on: February 02, 2013, 08:23:54 pm
|
Anyone know of places to buy this kind of thing in NYC? I'm sick of shipping stuff from China ;p I love the optical sensor idea... have an opaque tab pass by it once per mirror rotation, yeah? Maybe I can source one from a discarded object. I believe old mouse wheels use this... what else?
newark.com? How far of a drive is it to Jersey from where you are?
|
|
|
|
|
24
|
Using Arduino / Project Guidance / Re: 12V automotive project
|
on: February 02, 2013, 08:18:27 pm
|
|
I made a brake light for a motorcycle. In order to detect when the brakes were being pressed I used a voltage divider. But I think If I were to do it again I would use a transistor and attach the 12v to the base with a large valued resistor and have the transistor pull the arduino pin to ground. That way if there is variation in the vehicle voltage, the pin still either sees 5v or 0v. My voltage divider would go from 3-5v depending on the motorcycles voltage. Works great but I think the transistor is a better idea. I guess the voltage divider would be good if you wanted to actually see about what the cars voltage was.
|
|
|
|
|
25
|
Using Arduino / Project Guidance / Re: RGB LED Matrix spread over 400 square feet (43 square meters)
|
on: January 29, 2013, 04:04:49 am
|
|
(40 / 0.2)^2 = 40,000 LED's * 3 channels = 120,000 channels. On it's own that's a lot of things to control, a lot of things to wire up, a lot of things to solder, a lot of things to buy. Buy you must do all of those things for each LED.
It took me hours to wire up 15 RGB LEDs in strands like Christmas lights. Each lead: cut, strip, tin, clip, align, solder, insulate, test.... 40,000 may take a lifetime.
Edit: Whoops i misread, but that still comes out to something like 900 LEDs. Not so out there, but we are still talking about weeks or months of work just to wire them together.
|
|
|
|
|
26
|
Using Arduino / Installation & Troubleshooting / Re: Troubleshooting sketchy uploads to breadboard
|
on: January 27, 2013, 08:07:08 pm
|
|
That button and resistor are going into Digital pin 2 (chip pin 4) for my project, that is not the reset stuff. Pin one is connected only to the reset pin on the arduino. It is as though the reset pin were still seated in the arduino socket so it should act exactly as it does while seated in the arduino. The only difference is I am using an external 8Mhz chip so it will not upload properly while seated in the arduino.
When I say I am manually resetting it, I mean I am taking a jumper that is connected to pin 1 and physically shorting it to the ground rail. When I do this, the chip continues to operate. I am clicking my button and it is reading out on Serial right where it left off.
The cap is just for decoupling because that rail is so far away from the arduino. Removing it doesn't change anything.
edit: I switched to a new atmega328 and it works fine now. I must've messed up the boot-loader somehow.
|
|
|
|
|
27
|
Using Arduino / Project Guidance / Re: Can I secure my code from being copied on arduino boards?
|
on: January 27, 2013, 07:47:18 pm
|
|
The arduino board is open source. Your project is not unless you make it so. As long as you don't share your files with anyone no one can see your code. And if someone really really wanted to go to some trouble they could maybe duplicate your chip. If that is a concern then CrossRoads' suggestion of Lock Bits would be of use to you.
|
|
|
|
|
28
|
Using Arduino / Installation & Troubleshooting / Re: Troubleshooting sketchy uploads to breadboard
|
on: January 27, 2013, 06:45:29 am
|
|
Like I said, the reset pin is wired to the reset pin on the arduino so it should act just like it does on the arduino.
But that's irrelevant because I cannot even pull it down manually. There's no problem with it being pulled up, it's running the last uploaded sketch just fine. I just can't get it to reset so it won't upload a new one.
|
|
|
|
|
29
|
Using Arduino / Installation & Troubleshooting / Re: Troubleshooting sketchy uploads to breadboard
|
on: January 27, 2013, 04:45:58 am
|
|
I'm using an external oscillator. The problem seems to be that the reset wont pull down, not that it wont stay up. During upload I have the reset pin connected to the reset pin on the arduino so it should act exactly as it does on the board as far as I'm aware. Does anyone know why the arduino would refuse to reset when pulled directly to ground? I mean I have it completely disconnect from anything else, then I put a jumper straight to ground and it still operates normally, it wont reset.
|
|
|
|
|