Show Posts
Pages: 1 ... 44 45 [46] 47 48 ... 50
676  Using Arduino / Programming Questions / printAddress out of scope using OneWire and DallasTemperature on: May 28, 2011, 04:13:11 pm
Well, probably something really obvious here, and I haven't written C for quite a while.

This is mostly just copy/paste from the Dallas example for multi-sensor, except I modified it to store the sensor addresses in an array. I'm using the TLC 3.6.0 library from Miles Burton, and the 1-wire v.2 from pjrc.

// just messing about with DS18B20

#include <OneWire.h>
#include <DallasTemperature.h>

// Data wire is plugged into pin 2 on the Arduino
#define ONE_WIRE_BUS 2

// Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs)
OneWire oneWire(ONE_WIRE_BUS);
// Pass our oneWire reference to Dallas Temperature.
DallasTemperature sensors(&oneWire);

int i;                 // loop counter
int numSensors;        // number of 1-wire sensors

// 1-wire device addresses using type defined in Dallas header
DeviceAddress owsAddr[8];

void setup()
  Serial.begin(9600);          //  setup serial

  // Start up the library
  numSensors = sensors.getDeviceCount();
  for (i = 0; i < numSensors; i++) {
    if ([i])) {
      Serial.print("DS18B20: ");
//    ^^^^^^^^^^^^ is the error line
    } else {
      Serial.println("Something sure is goofy here!");
Error pane
onewiretest.cpp: In function ‘void setup()’:
onewiretest:30: error: ‘printAddress’ was not declared in this scope
Assuming this function had to be defined in either the OneWire or Dallas libraries, I grepped the header and .cpp files for both of those, and found nothing. I find that interesting, but of course, it could be defined someplace else.

BTW, I know I can code something up and bitshift the address out. At the moment, I just want to label my sensors so when I actually place them, I know what's where. But it bugs me that I'm getting an error on something direct from example code. Of course, that code could be wrong (did they test it before posting?).
677  Using Arduino / Sensors / Re: LM335 Sensor question on: May 28, 2011, 08:24:24 am
Can you post of photo or drawing of how you have this wired?
678  Using Arduino / Sensors / Re: LM335 Sensor question on: May 27, 2011, 06:36:50 pm
How close is your sensor to the LEDs?

Also, what happens in your code if Celsius = 15?
679  Using Arduino / General Electronics / Re: LM317 Help on: May 27, 2011, 06:11:14 pm
Nothing against the LM317T. I once bought a barrel of 14,000 of them for $55 from a junkyard near IBM  smiley I'll send 5 to anyone who'll send a SASE... I still have about 500 left.

Cool! Would 2 "forever" stamps be sufficient postage? Maybe 3 to be sure, eh?

Thanks, Terry.
680  Community / Bar Sport / Re: Does anybody really know what time it is? on: May 27, 2011, 04:33:20 pm
I'm assuming that's Greenwich
No, sorry, BST

Bacon, Spam, & Tomato?  smiley-eek
681  Community / Bar Sport / Re: Does anybody really know what time it is? on: May 27, 2011, 03:08:43 pm
An atomic clock is actually something that should better be called a frequency normal. If you need very accurate  _time_ at a budget go to *bay and buy a used Trimble Thunderbolt module.

Egadz. Those things are ~£900 new. And that's just the unit itself. I wish I were operating on your definition of "at a budget". smiley (Yeah, I know, e-bay used is cheaper.)
682  Community / Bar Sport / Re: Does anybody really know what time it is? on: May 27, 2011, 03:04:24 pm
Quarter to two.

I'm assuming that's Greenwich. So that means it's actually 6:45.
683  Using Arduino / LEDs and Multiplexing / Re: Understanding Shift Registers on: May 26, 2011, 09:44:34 pm
See also the Complete Beginners Guide to Arduino from Earthshine Electronics, page 41.
684  Community / Bar Sport / Does anybody really know what time it is? on: May 26, 2011, 09:16:38 pm
So after reading several posts about various RTCs available, vs. using mains frequency, I've collected a few thoughts.

I don't see much talking about RTCs from SII (Seiko) or Intersil, which sport (in some cases) 1ppm of resolution (presumably, you have to hold your tongue right, and perform other rites to achieve this). I do see a thread on the Intersil ISL12022. I'm not thinking of buying one of these (yet), just curious.

But if you're really interested in extremes, there's the Atomic clock on a chip, which has yet to go to production, AFAIK. Might be a bit of a wait before we see one on a breakout board from Sparkfun, or someone else.

OTOH, maybe this is all a bit much. There are, apparently, people willing to spend $300,000 on a watch that tells only day and night. Heck, I can duplicate that with a Promini and an LDR.

BTW, in case anyone doesn't get the post title: (long intro version)
685  Using Arduino / Project Guidance / Re: Measuring Mains Voltage on: May 24, 2011, 10:22:01 pm
Something like:  Hot wire -> 1M resistor -> some other value resistor ->1M resistor -> neutral wire.  I would measure the voltage across the middle resistor at the arduino and tailor the value to keep it in the 1-2 volt range.

Maybe I'm missing something, but that sounds like: (obviously, I should have put a load on the far right line)

So the voltage is always going to be nominally 110VAC. So that doesn't tell you anything about how much current your freezer is drawing when it's running. Don't you need something more like a clamp-on ammeter?
686  Using Arduino / General Electronics / Re: 1hz clock on: May 24, 2011, 05:37:02 pm
Yeah that 'NITS' atomic clock isn't all it's hyped up to be ;-)

The Knights of NI have a Time Service?

What is the average hz of an unladen swallow's wingbeat? smiley-mr-green
687  Using Arduino / Project Guidance / Re: Piezo Help on: May 22, 2011, 07:06:34 pm
A piezo detects vibration. Taped down like that, how is it supposed to vibrate?

Do you think that packaging tape is much of a damper? If the sensor is in contact with the table, and the table is transmitting sound waves, doesn't the sensor perform better if it's kept in good contact?
688  General Category / General Discussion / Re: Finally, actually got something done. Yay Me! on: May 22, 2011, 06:51:17 pm
Oh yeah. I learned how much easier it is to solder SMD components when you pre-flux them. And how to load a new bootloader. And how not to hang your board by saturating the TX on the USB.  smiley-grin

Next up, one-wire.
689  General Category / General Discussion / Re: Finally, actually got something done. Yay Me! on: May 22, 2011, 05:03:35 pm
Well, I wired it up sort of like your circuit here. Except I have a 220Ω R for the green, and a 330Ω for the red, to try to balance the intensity a bit. Kinda makes me go meh as a quickie visual indicator of over/under temp, which is where I was hoping to use this -- right now, I'm using a pot as a proxy for a temp. sensor. The shading is somewhat poorly mixed, so the yellow midpoint doesn't really look yellow.

Might be I'll need to go for a RGB LED, so I can ramp the color more clearly away from the OK state.

But I didn't let any smoke out.  smiley-razz
690  Using Arduino / Project Guidance / Re: Controlling proportional valves on: May 22, 2011, 12:31:49 pm
i'd like to control a proportional solenoid valve, the valve is 12vdc and is controlled by varying the current from 0mA to 330mA.
I'd like to use a pot to vary the current. Connecting the pot is not a problem as there are loads of examples of reading a signal from a pot suppiled with 5v.

The part I could do with some pointers with is supplying 24v and a current of upto 330mA controlled by the signal from the arduino.

Well, one thing is to get a few things in order re. voltage/current. You start out by saying the valve is 12VDC, but then want to supply 24VDC. In reading the spec sheet, I see the valves can be ordered in either (nominally) a 12V or 24V configuration. But current is proportional to voltage, and current is the controlling  item here. The voltage needed to drive the coil with current N will be determined by Ohm's law, V=IR. If we assume that the nominal voltage is somewhat close to what will be needed at maximum current, then we can calculate the coil resistance by V/I=R:
 * 12/.330=36
 * 24/.165=145
But what I suspect is that the voltage rating of valves is there as a guide for what sort of power supply you'll need, and maybe as  a ceiling value to avoid burning out the coil. I didn't examine that datasheet in detail, but I suspect there are wattage ratings on those things, which are likely close to what you'll get if you calculate the wattage from the above. The further point is that as the current decreases, so will the voltage.

If I were trying to do this, I might look at current regulators, with the control pin driven from the Arduino's analog out. But I admit I haven't thought  through all the details of that.
Pages: 1 ... 44 45 [46] 47 48 ... 50