Show Posts
Pages: [1] 2
1  Using Arduino / Programming Questions / Re: Is the eye able to see flashes at 30kHz? on: March 19, 2013, 03:43:28 am
The simple answer is: No.

Think about mains power, which dependent on where you live runs at 50/60Hz. If you've seen LED bulbs run on mains, AC Christmas lights for example, because the cheaper types only run 50% of the time, you can notice the flicker, but only just. However the effect becomes far more noticeable when either the bulb or you are moving. This is due to persistence of image.

At 37kHz you wouldn't see anything but a dimmed light.

It's far more likely that the flicker you're seeing is due to other factors, such as code or hardware not being up to the task of switching it that fast.
2  Using Arduino / Programming Questions / Re: IF temperature > 24 --> hot hot hot on: March 15, 2013, 10:40:12 am
You may also want to take multiple readings before you display a value,

Take an average of the temperature over the last 10 or so readings then display that value. I believe there's a useful guide of smoothing on the arduino site.
3  Using Arduino / Displays / Re: M2TKLIB - A User-Interface-Toolkit for the Arduino Hardware on: March 12, 2013, 03:26:17 pm
Cheers olikraus,

Is there a signed flavour of uint8_t?

Same goal as last time, trying to use a range of -20 to 80 within M2_S8NUM with my rotary encoder.

Finally got a standard rotary encoder, it works very smoothly with your implimentation.
Just begining to put together my menu now i've got my prototyping rig set up since this weekend.

Code:
#include <LiquidCrystal.h>
#include "M2tk.h"
#include "utility/m2ghlc.h"

LiquidCrystal lcd(12, 11, 7, 6, 5, 4);

//=================================================
// Forward declaration of the toplevel element
M2_EXTERN_ALIGN(top_menu);

//=================================================
// Simple dialog: Input two values n1 and n2

sint8_t n1 = 0;
uint8_t n2 = 0;

M2_LABEL(el_l1, NULL, "Temperature:");
M2_S8NUM(el_u1, "c2", -20, 80, &n1);
M2_LABEL(el_l2, NULL, "Humidity:");
M2_U8NUM(el_u2, "c2", 0, 100, &n2);

M2_LIST(list) = { &el_l1, &el_u1, &el_l2, &el_u2 };
M2_GRIDLIST(el_gridlist, "c2", list);
M2_ALIGN(top_menu, "-1|1W64H64", &el_gridlist);

// m2 object and constructor
// Note: Use the "m2_eh_4bd" handler, which fits better to the "m2_es_arduino_rotary_encoder"
M2tk m2(&top_menu, m2_es_arduino_rotary_encoder, m2_eh_4bd, m2_gh_lc);

//=================================================
// Arduino Setup & Loop

void setup() {
  m2_SetLiquidCrystal(&lcd, 20, 4);
  
  // define button for the select message
  m2.setPin(M2_KEY_SELECT, 8);
  
  // The incremental rotary encoder is conected to these two pins
  m2.setPin(M2_KEY_ROT_ENC_A, 2);
  m2.setPin(M2_KEY_ROT_ENC_B, 3);
}

void loop() {
  m2.checkKey();
  m2.checkKey();
  if ( m2.handleKey() )
    m2.draw();
  m2.checkKey();
}

Also, what is the purpose of calling "m2.checkKey();" multiple times within the main loop?

I'm also confused about how i pass a value back through the callback procedure. I was looking at the example code and i'm unsure how i would use that. Say for example i wanted to do a Serial.print(); of the current S8NUM value for el_u1.

Code:
uint8_t global_value = 0;
 
uint8_t u8_cb(m2_rom_void_p element, uint8_t msg, uint8_t val)
{
  if ( msg == M2_U8_MSG_SET_VALUE )
    global_value = val;
  return global_value;
}

M2_U8NUMFN(el_u8_cb, NULL, 0, 10, u8_cb);

Thank you for putting up with me! I'm a determined Newb i'm afraid.
4  Using Arduino / General Electronics / Re: Is temperature linear to analog readings? on: February 18, 2013, 03:26:16 am
There's a rather nice example on one of the Arduino pages:

I've been using this with my 4k7 thermistor to test my code before i got my big expensive temperature/relative humidity probe.

http://playground.arduino.cc//ComponentLib/Thermistor2

I don't think it's the most accurate thing in the world, but it agrees with the also cheap temperature sensor in my room (+-1c).

Good enough to test a PID on my electric heater!
5  Using Arduino / General Electronics / Re: Have I blown something? on: February 15, 2013, 10:33:13 am
It looks like the voltage regulator for that specific board is an option extra, so you may be right that it got exposed to 12V at the microchip and died by electrocution.

Never nice to have a board die :/

Edit: Looks like even with the voltage regulator it can only handle 5-9V, so even then it probably would have died.
6  Using Arduino / General Electronics / Re: FAN PWM Control on: February 15, 2013, 10:28:18 am
As a fan is a motor you have to contend with something known as "inrush current". This is generally taken to be six times the full load current (on large motors, no idea what it is on small fans). The datasheet should tell you what the full load and starting currents will be at a voltage.

With that in mind consider that the Arduino can only source a rather small amount of current, if you put anything that's good at sinking current (motors, hint hint) you'll end up overheating and damaging your microcontroller.

What you need to do is have an external supply with the Arduino controlling that supplies path to the motor, you could use a transistor for example. You might also want to add protection like optical isolation and diodes to prevent back emf.
7  Using Arduino / Project Guidance / Re: Using rele 12V on: February 15, 2013, 10:17:57 am
Can you tell us which pins you've connected everything too and give us your code.
8  Using Arduino / General Electronics / Re: Input output interfacing on: February 15, 2013, 09:42:19 am
I think i should get a fairly high precision output with the methods we've discussed, but I've been having a quick look at DAC's.

Is there such a component that'll take a serial input, convert it to analog with a 8 bit precision; is through hole type with 4 DAC's in the same chip, will output a range covering 0-10v and can source 40mA or so?

Probably not, but i could buya quad 8 bit serial DAC chips then put the output through an op-amp with a gain of one. Worth the effort?

Something like this perhaps?
http://uk.rs-online.com/web/p/general-purpose-dacs/7321512/
or
http://uk.rs-online.com/web/p/general-purpose-dacs/2006656/
9  Using Arduino / Motors, Mechanics, and Power / Re: arduino controlled computer fan controller on: February 15, 2013, 06:42:53 am
Smoothing the PWM to your fan should be fine and should eliminate the noise.

You might want to look at using a MOSFET rather than a BJT.

See here for previous discussion:
http://arduino.cc/forum/index.php?action=printpage;topic=91454.0
10  Using Arduino / Project Guidance / Re: Relay for automating my garden on: February 15, 2013, 06:28:14 am
man3l3t, you'll have to make a new thread to get new questions answered.
11  Using Arduino / Project Guidance / Re: Arduino based Stereo Canon DSLR Interval Trigger on: February 15, 2013, 06:21:08 am
I agree relays seem a bit heavy duty for this application. I should think that a simple opto-isolator would be fine for switching. When you get the cameras, i'd imagine they have some current limiting already built in, but give it a quick measure like jabbado did and see if you need a resister in series. That way you can get rid of the 9v supply.
Everything else seems fine.

I'd defiantly go for a solid state solution, any bounce on mechanical components like a relay could make your camera do strange things.
12  Using Arduino / General Electronics / Re: Input output interfacing on: February 14, 2013, 10:12:13 am
Cheers, that's a good source for next time. Unfortunately i'm in the UK and i needed them urgently. I guess i should start looking for SMT now.

My project is to build a controller for temperature and humidity for a meat curing room capable of curing various different products. It's controlling a heater, cooler, humidifier and dehumidifier. (needs to go + and - of ambient).

Got all the code working with PID control (had many arguments with uni friends on the best control method!), which is fine for prototyping. Got the screen and a rudimentary menu system working with a rotary encoder w/push button.

I had an I/O interface board before, similar design to above, but the sensor supplier fitted a 4-20mA sensor and told me it was a 0-10v version... needless to say the 12v supply didn't go where it should have and i had one dead sensor and Arduino mega. I was not pleased.

Plenty to do still!
Data logging
Watchdog timer
SMS support
better menu
resume on loss of power
better system for creating, deleting and editing programs
13  Using Arduino / General Electronics / Re: Input output interfacing on: February 14, 2013, 09:43:33 am
Good idea.

I'd like to get all (plus x3 of the op amp circuits) of this plus other bits like an RTC, SD card and screw terminal blocks on a custom PCB shield. I've yet ot lay it out but i think space may be at a premium.

Also some more interfaces (input 0-10v, 4-20mA output), for future use perhaps.
Ooh, maybe networking and SMS compatibility too.

I'm getting ahead of myself, get this working first... Do other stuff on other shields.
14  Using Arduino / General Electronics / Re: Current measurement on positive or negative side? on: February 14, 2013, 07:29:46 am
Look up Kirchhoff's current law, Current will be the same whatever side you put the sensor, assuming it doesn't branch off at some point. Make sure you put it in series!
15  Using Arduino / Project Guidance / Re: Clean and energy efficient LED dimming on: February 14, 2013, 06:11:48 am
I really wouldn't worry about an SSR drawing power when its turned off. If it does at all i suspect it would be in the µA range. It's not going to make a difference to your electricity bill.
Pages: [1] 2