Show Posts
Pages: 1 ... 57 58 [59] 60 61 ... 183
871  Community / Exhibition / Gallery / Re: Toorum's Quest II - ATmega328P based retro video game with 256 color graphics on: November 10, 2013, 12:51:49 am
I thought I'd do quick search on the rgb / ntsc chip...

It seems there's quite a lot going on!
872  Using Arduino / General Electronics / Re: Shorting Digital Output pins together - ok or not ok? on: November 09, 2013, 08:11:43 pm
Due to the max current constraints (ie if all the pins  were high) it's not going to be 40ma per pin or rarther it will be up to a certain amount of current.

Then using resistors to balance the load....
873  Using Arduino / General Electronics / Re: reverse polarity protection on multiple input power lines using FETS on: November 09, 2013, 03:54:22 pm
In the meantime, here is a nifty circuit I recently saw, that automatically switches the power supply polarity if incorrect. The voltage across the load is always positive, regardless of the polarity of the voltage applied to IN1 and IN2. Of course, the thresholds of the mosfets must be chosen appropriately. The original circuit used the Fairchild FDS8958A, which includes a matched pair of PMOS and NMOS transistors in one package.

Any idea what the advantage is over using several  diodes to achieve the same thing?
874  Using Arduino / General Electronics / Re: Understanding and using a MOSFET on: November 09, 2013, 07:00:48 am
Have you attached a resistor (say 10k) from gnd to the gate (to keep the fet off) when not in use to prevent it floating
875  Using Arduino / General Electronics / Re: Did I fry my Leonardo? (CPR for my Arduino required) on: November 07, 2013, 07:00:02 pm
Sounds fried...

Add some fish to your fried chips?
876  Using Arduino / Networking, Protocols, and Devices / uploading sketches via bluetooth on: November 07, 2013, 11:46:51 am
I got wondering, if I used pins 0/1 with a bluetooth uart.

Could I upload firmware (a reset command could be sent to trigger a hardware reset) using a regular bt breakout & an Arduino?
877  Using Arduino / General Electronics / Re: Reliable Debounce Circuit on: November 07, 2013, 09:14:14 am
polymorph, you really need to brush up on your common decency/ people skills.  (since i accepted it was a mistake from over tiredness if you must know)
878  Using Arduino / General Electronics / Re: Reliable Debounce Circuit on: November 07, 2013, 09:11:53 am
cjdelphi, you really need to brush up on basic electricity and electronics if you are going to continue trying to offer advice.

A 10uF surface mount capacitor isn't really that large. I suggest it might be better to incorporate switch debouncing in software. Perhaps it wakes up on button press, then starts a timer while still checking to see if you are still holding the button. If you are not still holding it after 1 second, it goes to sleep again. If you are, it wakes up the rest of the circuit.

I strongly suggest you do NOT use delay() to accomplish this. All that will tell you is if the button is held down at the end of 1 second. You could have let go and pressed it again, or it could get a pulse of noise from something at just that moment. There is no checking to make sure you have been pressing the button during that time.

Look at the example "Blink Without Delay" for inspiration.

it's not "advice" it was a mistake now get over yourself.
879  Using Arduino / General Electronics / Re: Reliable Debounce Circuit on: November 07, 2013, 08:44:54 am
As for the diode, the diode allows the cap to quickly and sharply transition states when you press the button (direct path to gnd) so it will discharge a lot quicker than relying on the resistor???

That is incorrect. The diode is reverse biased when the capacitor is charged and you press the button.

The diode bypasses the discharge resistor when you let go of the pushbutton.

Thank you for the information, but you're also incorrect... i added "????" meaning (to me at least) it's a question, the way i phrased it was bad I know....  but i meant it as a question.


but yes after looking at it again, i see where i was going wrong... I was for some reason thinking + could get to gnd (and discharge) but it can't because of the diode. (i got confused)
880  Using Arduino / Networking, Protocols, and Devices / Re: SPI - Pullup/down required? [Solved it myself] on: November 07, 2013, 08:16:38 am
SI pins is for selecting the interface
From the datasheet
SI Pin ---Select Interface (GND->SPI or VDD->I²C
So if you wire it to ground you will use it as SPI interface, if pulled to VDD it will be using I2C.

ahhh.... duh!

Thanks  smiley-red
881  Using Arduino / Networking, Protocols, and Devices / SPI - Pullup/down required? [Solved it myself] on: November 07, 2013, 06:02:19 am
Months and Months ago, i bought 2 tatuic lightning sensor boards.. both gave different results so finally today i got the soldering iron out and wired them all up.

Now when i bring my hand up close to where the pins are on the Arduino, the sketch goes mental

Out of range lightning detected.
Noise level too high, try adjusting noise floor
Disturber detected
Out of range lightning detected.
Noise level too high, try adjusting noise floor
Disturber detected
Out of range lightning detected.

So then, before I start collecting schematics, datasheets, posting pictures..

When i bring my hand close to the clock/data pins it goes mad, so does this mean I simply need to connect a pullup/pulldown? I never had issues with SPI programming attiny85's though..

  LightningDetector.pde - AS3935 Franklin Lightning Sensor™ IC by AMS library demo code
  Copyright (c) 2012 Raivis Rengelis (raivis [at] All rights reserved.

  This library is free software; you can redistribute it and/or
  modify it under the terms of the GNU Lesser General Public
  License as published by the Free Software Foundation; either
  version 3 of the License, or (at your option) any later version.

  This library is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  Lesser General Public License for more details.

  You should have received a copy of the GNU Lesser General Public
  License along with this library; if not, write to the Free Software
  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA

#include <SPI.h>
#include <AS3935.h>

void printAS3935Registers();

// Function prototype that provides SPI transfer and is passed to
// AS3935 to be used from within library, it is defined later in main sketch.
// That is up to user to deal with specific implementation of SPI
// Note that AS3935 library requires this function to have exactly this signature
// and it can not be member function of any C++ class, which happens
// to be almost any Arduino library
// Please make sure your implementation of choice does not deal with CS pin,
// library takes care about it on it's own
byte SPItransfer(byte sendByte);

// Iterrupt handler for AS3935 irqs
// and flag variable that indicates interrupt has been triggered
// Variables that get changed in interrupt routines need to be declared volatile
// otherwise compiler can optimize them away, assuming they never get changed
void AS3935Irq();
volatile int AS3935IrqTriggered;

// First parameter - SPI transfer function, second - Arduino pin used for CS
// and finally third argument - Arduino pin used for IRQ
// It is good idea to chose pin that has interrupts attached, that way one can use
// attachInterrupt in sketch to detect interrupt
// Library internally polls this pin when doing calibration, so being an interrupt pin
// is not a requirement
AS3935 AS3935(SPItransfer,SS,2);

void setup()
  // first begin, then set parameters
  // NB! chip uses SPI MODE1
  // NB! max SPI clock speed that chip supports is 2MHz,
  // but never use 500kHz, because that will cause interference
  // to lightning detection circuit
  // and chip is MSB first
  // reset all internal register values to defaults
  // and run calibration
  // if lightning detector can not tune tank circuit to required tolerance,
  // calibration function will return false
    Serial.println("Tuning out of range, check your wiring, your sensor and make sure physics laws have not changed!");

  // since this is demo code, we just go on minding our own business and ignore the fact that someone divided by zero

  // first let's turn on disturber indication and print some register values from AS3935
  // tell AS3935 we are indoors, for outdoors use setOutdoors() function
  // turn on indication of distrubers, once you have AS3935 all tuned, you can turn those off with disableDisturbers()
  AS3935IrqTriggered = 0;
  // Using interrupts means you do not have to check for pin being set continiously, chip does that for you and
  // notifies your code
  // demo is written and tested on ChipKit MAX32, irq pin is connected to max32 pin 2, that corresponds to interrupt 1
  // look up what pins can be used as interrupts on your specific board and how pins map to int numbers

  // ChipKit Max32 - irq connected to pin 2
  // uncomment line below and comment out line above for Arduino Mega 2560, irq still connected to pin 2
  // attachInterrupt(0,AS3935Irq,RISING);

void loop()
  // here we go into loop checking if interrupt has been triggered, which kind of defeats
  // the whole purpose of interrupts, but in real life you could put your chip to sleep
  // and lower power consumption or do other nifty things
    // reset the flag
    AS3935IrqTriggered = 0;
    // first step is to find out what caused interrupt
    // as soon as we read interrupt cause register, irq pin goes low
    int irqSource = AS3935.interruptSource();
    // returned value is bitmap field, bit 0 - noise level too high, bit 2 - disturber detected, and finally bit 3 - lightning!
    if (irqSource & 0b0001)
      Serial.println("Noise level too high, try adjusting noise floor");
    if (irqSource & 0b0100)
      Serial.println("Disturber detected");
    if (irqSource & 0b1000)
      // need to find how far that lightning stroke, function returns approximate distance in kilometers,
      // where value 1 represents storm in detector's near victinity, and 63 - very distant, out of range stroke
      // everything in between is just distance in kilometers
      int strokeDistance = AS3935.lightningDistanceKm();
      if (strokeDistance == 1)
        Serial.println("Storm overhead, watch out!");
      if (strokeDistance == 63)
        Serial.println("Out of range lightning detected.");
      if (strokeDistance < 63 && strokeDistance > 1)
        Serial.print("Lightning detected ");
        Serial.println(" kilometers away.");

void printAS3935Registers()
  int noiseFloor = AS3935.getNoiseFloor();
  int spikeRejection = AS3935.getSpikeRejection();
  int watchdogThreshold = AS3935.getWatchdogThreshold();
  Serial.print("Noise floor is: ");
  Serial.print("Spike rejection is: ");
  Serial.print("Watchdog threshold is: ");

// this is implementation of SPI transfer that gets passed to AS3935
// you can (hopefully) wrap any SPI implementation in this
byte SPItransfer(byte sendByte)
  return SPI.transfer(sendByte);

// this is irq handler for AS3935 interrupts, has to return void and take no arguments
// always make code in interrupt handlers fast and short
void AS3935Irq()
  AS3935IrqTriggered = 1;

// pin name:    not-mega:         mega(1280 and 2560)
// slave reset: 10:               53
// MOSI:        11:               51
// MISO:        12:               50
// SCK:         13:               52

So pins 10,11,12,13 the "irq" goes to pin 3.

PDF - Technical, wiring.

The only wire I don't have connected (Because well, I honestly have no idea where to put it..) is the "SI" pin..

So does this SI need to be connected somewhere or am i missing pullups/downs?  (based on the fact just getting near the wires makes them go mental)...  

Any suggestions?


Basically, this last unused pin... after some searching I found it, and in the code above it says pull to gnd.. no problems, I did and what do you know... 18 months later it works !

So SI pin to gnd seems to have fixed it... whatever SI is.
882  Using Arduino / Microcontrollers / Re: Virtual Memory? on: November 07, 2013, 04:52:10 am
Allocating virtual ram either from SD card or otherwise.
Tell me about your page-fault mechanism.

Not even in the right forest, far less barking up the wrong tree.

I never claimed it to be easy.... in theory could it be done?           

(I'd store huge amounts of arrays into memory virtually, might be slow but it could also be useful)
883  Using Arduino / Microcontrollers / Virtual Memory? on: November 06, 2013, 11:46:59 pm
Allocating virtual ram either from SD card or otherwise..

A replacement set of routines that when used store the data else where (with an internet shield for example and the cloud or with an SD breakout)

Literally writing out your memory elsewhere and retrieving it ...  allowing an Arduino to do some  interesting things?  (or am i barking up the wrong tree) ?
884  Community / Bar Sport / Re: Arduino powered by capacitor on: November 06, 2013, 11:34:12 pm
I ran an automotive 12v bulb the other day from 2 400F caps (via a step up inverter) it lasted around 40 seconds or so...

And i kinda welded (by accident) a resistor leg to the casing lol
885  Using Arduino / General Electronics / Re: Reliable Debounce Circuit on: November 06, 2013, 10:37:58 pm
Easier to use a circuit emulator (there's a few good free ones about, like ltspice) once you got it, increase the resistor sizes to compensate for the smaller capacity of the smt capacitors (unless it's not a ceramic and it's an electrolytic)

Pages: 1 ... 57 58 [59] 60 61 ... 183