Go Down

Topic: Klingon Proton Collector (Read 19389 times) previous topic - next topic

Paul__B

Why are we using an Arduino to do the job of a NE555?

:~

PaulRB


Why are we using an Arduino to do the job of a NE555?

:~



Michael wants some beep tones, some fading leds and a thermistor, hall sensor or something. This is just the first step. The plan is to use a tiny85 for the final version.

PaulRB

Michael, how about one of these hall sensors:

http://www.ebay.co.uk/itm/HALL-EFFECT-SENSOR-SIP-3-1301-Part-A1301EUA-T-/350819442998?pt=UK_BOI_Electrical_Components_Supplies_ET&hash=item51ae77e136

They should be easy to use, just connect the leads to 0V, 5V and an analog input on the Arduino. The reading from analogRead() should be around 512 when no magnetic field is present, but will rise above that or fall below it when north or south poles of magnets are detected.

PaulRB

#33
Aug 24, 2014, 08:43 pm Last Edit: Aug 24, 2014, 08:58 pm by PaulRB Reason: 1
Hi Michael, here is the circuit with the 4 leds using only one Arduino pin:

http://youtu.be/LAaBVV0uHVc

And next with a pot to control the speed:

http://youtu.be/jUOlHL1nZZg

jameskirk

Paul what sketch did you use for that???
Thanks
Michael

jameskirk

Is there a way to have it blink at one rate for so long then blink at another rate for so long in the same sketch???
Thanks
Michael

PaulRB


Paul what sketch did you use for that???


This is just the "blink" example sketch with a couple of adjustments:
Code: [Select]
/*
  Blink
Turns on an LED on for one second, then off for one second, repeatedly.

This example code is in the public domain.
*/

// Pin 13 has an LED connected on most Arduino boards.
// give it a name:
int led = 2;

// the setup routine runs once when you press reset:
void setup() {               
  // initialize the digital pin as an output.
  pinMode(led, OUTPUT);     
}

// the loop routine runs over and over again forever:
void loop() {
  int d = analogRead(A1);
  digitalWrite(led, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(d);               // wait for a second
  digitalWrite(led, LOW);    // turn the LED off by making the voltage LOW
  delay(d);               // wait for a second
}

PaulRB


Is there a way to have it blink at one rate for so long then blink at another rate for so long in the same sketch???


Yes, all perfectly do-able.

Paul__B


Is there a way to have it blink at one rate for so long then blink at another rate for so long in the same sketch???
Thanks
Michael

Hey, we are dealing with a microprocessor here, it's no slouch.

If you program it to do so, it can do hundreds of different patterns before breakfast.   :D

jameskirk

The reason I ask this is we wouldn't need a pot to adjust the lights if
we can have it speed up after a certain amount of time...
Can we still use the Piezo speaker to make sound for it???
Thanks
Michael

dave-in-nj

thread started on the 11th.

yes,, yes and yes again.

you have have the lights blink the lights get bright (the other lights, not just the X ones)
have the X lights blink faster or slower
have the sound increase in pitch or volume. as you please
all at the same time.

you missed what others offered.  adding a HALL sensor, a metal detctor really, so if you put the unit on drywall, it will blink slow, but when it 'finds' a metal stud or nail it will start blinking faster.

and yes.. you have have it blink faster and faster until the chambers fill.

There are lots of ways to use a sensor that it has to 'find' some thing.   I like needing power such as a wire in a wall,

all these are possible, and there have already been code provided.

now it is time you grabbed the bull by the horns and start learning how to program.
as you learn, you will figure out what external senors you want and what speed you want and how you want to control it.

jameskirk

What I read about hall sensors is that you have to use a magnet to
make them work that's why I was steering away from them...
Even the videos I have seen about hall sensors say you need a magnet...
I'm doing this slow so I can learn it i'm not a fast learner when it comes to this...
Plus we haven't discussed about the other 2 LED's yet...
Michael

PaulRB

#42
Aug 25, 2014, 09:46 am Last Edit: Aug 25, 2014, 12:19 pm by PaulRB Reason: 1
A hall effect sensor will detect wires inside a wall where there is a current flowing. Any current creates a magnetic field around it and the hall sensor will pick this up.

They can also be used to detect metal (ferous) objects. What you do is fix a small magnet in place next to the hall sensor. This will give a certain reading. Then if a large ferous object comes close, it will affect the magnetic field produced by the magnet, and the sensor reading will change.

If you just want the proton collector to fill up based on a simple timer for now, I can write you a simple sketch to get you started, based on the blink sketch. But you must make the effort to understand the sketch and not be afraid to learn by experimenting with it. I don't want you to become reliant on me or anyone else here to write all your sketches for you.
Code: [Select]
/*
  Klingon Proton Detector Sketch
*/

int xleds = 2;
int xledDelay = 1000; // Controls the rate of the X-leds flashing

// the setup routine runs once when you press reset:
void setup() {               
  // initialize the digital pin as an output.
  pinMode(xleds, OUTPUT);
}

// the loop routine runs over and over again forever:
void loop() {
  digitalWrite(xleds, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(xledDelay);               // wait for a second
  digitalWrite(xleds, LOW);    // turn the LED off by making the voltage LOW
  delay(xledDelay);               // wait for a second
 
  xledDelay -= (xledDelay - 50) / 50; //increase the flashing speed a little
}


But first things first. See if you can get the X leds running from a single digital output on your breadboard.

jameskirk

I did get it running with a single output...
The boards i'm using only has one power/ground rail on each side...
I ordered a new board... also I found out why it wasn't working with only
one pin the power rail on my board must have a break in the board
because it wasn't powering the LED's...
I'm using another board that I have so it works now...
I'll try the new sketch to see how that works out...
Thanks
Michael

PaulRB

http://youtu.be/_AHS8KmIZeY

Go Up