Show Posts
|
|
Pages: 1 ... 6 7 [8] 9 10
|
|
106
|
Forum 2005-2010 (read only) / Interfacing / VDIP1 datalogger
|
on: May 21, 2010, 07:20:14 pm
|
Hi all, I'm making a temperature data logger with a VDIP1 module. I got it working last night with a set phrase, but now I'm reading an LM35 and trying to store that. Here's the code: #include <NewSoftSerial.h>
NewSoftSerial mySerial(3, 4); float temp; int lmPin = 0; int noOfChars;
void setup() { Serial.begin(9600); mySerial.begin(9600); mySerial.print("IPA"); mySerial.print(13, BYTE); Serial.println("Setupdone"); }
void loop() { temp = ((5 * 100 * analogRead(lmPin)) / 1024); temp = temp * 9 / 5 + 32; if(temp > 100) { noOfChars = 7; } if(temp == 100) { noOfChars = 7; } if(temp < 100) { noOfChars = 6; } mySerial.print("OPW LOG%1"); mySerial.print(".TXT"); mySerial.print(13, BYTE); delay(10); mySerial.print("WRF "); mySerial.print(noOfChars); mySerial.print(13, BYTE); mySerial.print(temp); mySerial.print(13, BYTE); mySerial.print("CLF LOG%1"); mySerial.print(".TXT"); mySerial.print(13, BYTE); Serial.print("WROTE TO FILE! "); Serial.println(temp); delay(100); }
I've got CTS and RTS (I think those are the names) tied together because I didn't want to put the time into handshaking yet. However, whatever I do, the lights on the VDIP1 alternately flash, pause, and flash again. No data is written to the file. Any ideas?
|
|
|
|
|
107
|
Forum 2005-2010 (read only) / Interfacing / Re: ultrasonic sensor. range finder with speaker
|
on: May 19, 2010, 09:47:49 pm
|
|
An easier solution would be to have distance related to pitch as opposed to distance related to volume.
However, one way to do it your way would be depending on the distance, rout the signal through one of several pins. ie at 10 feet, pin 1, at 5 feet, pin 2, at 2 feet pin 3 etc. Each of these pins would have a different value resistor, increasing as distance increases.
I'm sure there are other ways but this came to mind quickly.
|
|
|
|
|
108
|
Forum 2005-2010 (read only) / Interfacing / Re: Potentiometer cuts off at one end of spectrum
|
on: May 17, 2010, 04:28:02 pm
|
I have found success! Once I figured out how sound actually works and wrote it all out, I figured that I wanted an exponential function as opposed to a root, which was what I had originally. Here's the final code: int speakerPin = 13; int potPin = 5; float frequency = 0;
void setup(){ pinMode(potPin, INPUT); pinMode(speakerPin, OUTPUT); }
void loop(){
frequency = analogRead(potPin); frequency = (sq(frequency) / 100); digitalWrite(speakerPin, HIGH); delayMicroseconds(frequency); digitalWrite(speakerPin, LOW); delayMicroseconds(frequency); }
And I'll probably end up putting a small capacitance sensor in there too to have actual notes instead of a constant sound. I might actually end up doing one for pitch and one for volume like a theremin, but that's later. Here's a picture of the final product, just to show it off some:  and the top and bottom compartments:   And I'm not sure if it'll embed the pictures correctly, so here are the links: http://img535.imageshack.us/i/photo10dr.jpg/http://img245.imageshack.us/i/photo11xj.jpg/http://img257.imageshack.us/i/photo12kz.jpg/I guess you're right about the pot not being good quality. I got the scale pretty good and all, but the blank space is still there at the end. Oh well. Just for future reference, any recommendations for quality pot distributors? Thanks for all the help, everyone!
|
|
|
|
|
109
|
Forum 2005-2010 (read only) / Interfacing / Re: Potentiometer cuts off at one end of spectrum
|
on: May 17, 2010, 11:13:41 am
|
|
Hmm. I just realized that it could be a problem of how sound works as opposed to how the arduino works. I wanted the return of the pot to directly correlate to the delay between pulses. However, sound pitch doesn't increase linearly when compared with time between pulses. ie an increase in 5 milliseconds will take a high note down a lot but won't change a low note much. So, I think my reasoning was wrong and that explains why the pitch increases so drastically at the higher end.
However, it still doesn't explain the blank space. It seems like a pot shouldn't have a range where it has the same resistance. Perhaps I'm using it wrong?
As for the ivariable confusion, that's my bad. "wavelength" and "frequency" are the same for the sketch's purposes. I changed one to the other halfway through and didn't get them all, I guess.
|
|
|
|
|
110
|
Forum 2005-2010 (read only) / Interfacing / Re: Potentiometer cuts off at one end of spectrum
|
on: May 16, 2010, 11:12:50 pm
|
|
Okay. tomorrow I'm going to run it through processing and see what happens.
What exactly do you mean by a transfer function? Is that just a way to change the returned frequency to the desired frequency?
Yeah, that's not a big deal. I don't mean for this to be accurate or anything, I just want a wide range of pitch.
Thanks for all you help!
|
|
|
|
|
111
|
Forum 2005-2010 (read only) / Interfacing / Re: Potentiometer cuts off at one end of spectrum
|
on: May 16, 2010, 10:52:25 pm
|
hmm. I'd rather not get another pot just because I have this one and it's already soldered in and everything. eh, poor planning. Hmm. I assumed it was a log pot and assumed that I wanted linear to get rid of the fast rise of pitch on the higher end. Here's the (uncommented, sorry) code I wrote to try to space it out some: int speakerPin = 13; int potPin = 5; float frequency = 0;
void setup(){ pinMode(potPin, INPUT); pinMode(speakerPin, OUTPUT); }
void loop(){ frequency = analogRead(potPin); frequency = log(wavelength) / log(100000); // This is the line I'm talking about below digitalWrite(speakerPin, HIGH); delayMicroseconds((1000 * wavelength) + 1000); digitalWrite(speakerPin, LOW); delayMicroseconds((1000 * wavelength) + 1000); }
I messed around with a bunch of different values for the second line for determining the frequency and that came out okay. I think the higher the value of where I have 100000 now, the better the range of tone. However, the increase in pitch is not even. As pitch increases, the increases in pitch increases, if that makes sense. Any ideas on how make each degree of rotation of the pot an even increase in pitch?
|
|
|
|
|
112
|
Forum 2005-2010 (read only) / Interfacing / Potentiometer cuts off at one end of spectrum
|
on: May 16, 2010, 10:28:36 pm
|
|
Hello, apologies in advance if there's already been a topic on this. I can't for the life of me figure out a good way to word it.
So I'm making a music toy where it reads a pot and outputs a square wave to a speaker, simple enough. It's also got switches and LEDs, but that's beside the point. My problem is this: at one end of the pot's rotation, the reading goes to zero before it actually finishes rotating. like, there is a range where it's just all zero. Also, right before it hits that range, the pitch increases much faster. Going by that, it's probably a log pot, correct? I'm pretty sure it's a 10k, but not positive.
in case it's relevant, I have +5v and ground on the two outside pins and analog pin in the middle.
|
|
|
|
|
114
|
Forum 2005-2010 (read only) / Interfacing / swapping out arduino chips
|
on: April 24, 2010, 08:59:23 pm
|
I've been thinking. If you want a lot of different projects all at the same time, you're going to need a lot of arduinos. So, rather than buying up a bunch of duemilanoves, it may be better to just buy a bunch of atmega 328 chips, program them with one board, and just swap them out into a breadboard when I need them. That raises the problem of components for the breadboard version of arduino. I like compactness and I'd rather not have a bunch of components on the board if I could combine them. I've seen people that have soldered all of the necessary components directly to a chip, which I love the idea of. However, will there be any problems when I insert the chip into the main arduino board? To clarify, I want to know if there's anything wrong with putting something along the lines of this: http://www.geocities.jp/arduino_diecimila/obaka/project-2/index_en.htmlinto the arduino board where the normal chip goes, just to program it and then remove the chip for the project.
|
|
|
|
|
115
|
Forum 2005-2010 (read only) / Interfacing / Re: What is the advantage of using an H bridge...
|
on: March 24, 2010, 11:28:58 am
|
|
yeah, I actually have the NKC electronics motor shield as well. It's not as convenient as one would hope. I tried using two motors from the dollar store fans and was confident that it would work perfectly, but I could never manage to get the motors to start up by themselves. I always had to give them a push start, even on the highest setting.
|
|
|
|
|
117
|
Forum 2005-2010 (read only) / Interfacing / Temperature data logger idea?
|
on: March 11, 2010, 10:52:08 pm
|
Alright guys, I've seen a few projects out there for logging data onto a memory stick with usb interfaces for the arduino and have decided to make one of my own. However, I'm unsure about which interface to buy. What I'm trying to do is monitor the temperature of a pipe using an LM34/34 (haven't decided which yet), and when the temperature goes above a certain point, start looking for the peak temperature in that period. For example, something along the lines of "If temp > 50, find the maximum reading in the time before it goes below 50 again", but in code form. Then, I want it to save the max temp to a flash drive, but you obviously need something to interface to the drive. The most commonly referred to one that I've seen is the VDIP1, but I recently came across the VDRIVE2. It seems to me that the VDRIVE2 accomplishes the same as the VDIP1 but with a heck of a lot fewer pins. Does one have an advantage over the other (e.g. data transfer speed)? As for data speed, I'd only be recording a temperature reading every ten minutes at least, probably much more spaced out. I'd also like to time stamp the readings, but there is another topic for that. Here's links to both of them: VDIP1- http://apple.clickandbuild.com/cnb/shop/ftdichip?op=catalogue-products-null&prodCategoryID=57&title=VDIP1VDRIVE2- http://apple.clickandbuild.com/cnb/shop/ftdichip?productID=64&search=VDRIVE2&op=catalogue-product_info-nullThanks in advance!
|
|
|
|
|
119
|
Forum 2005-2010 (read only) / Interfacing / NKC electronics motor shield used with other parts
|
on: January 30, 2010, 01:18:30 am
|
Hi all, I recently bought and assembled this motor shield from NKC electronics: http://www.nkcelectronics.com/freeduino-arduino-motor-control-shield-kit.htmlIt works great and I'm happy with it. However, I was going to use it and some other components, (ultrasonic range finder, infrared LEDs, etc) to make a robot. There is just one problem. The motor shield takes up all of the digital pins (and the rest of the pins for that matter, except the analogs and TX and RX). So, I have two questions: 1) can I use the Tx and Rx pins to control components? or are they just for communication with a computer? 2) if not, any ideas about how to get some digital pins, or an equivalent, available? Thanks!
|
|
|
|
|