Show Posts
Pages: 1 ... 9 10 [11] 12 13 ... 25
151  Using Arduino / Microcontrollers / Re: ATMega1284p issues with SD Card on: May 06, 2013, 03:12:28 pm
Good, that's a step in the right direction from jeelib, I think. I've heard of the
lowpower RFM12 library, but not used it.

Your sketch doesn't show specifically how your library code is using the SPI port,
but I imagine that's where the problem is. IE, proper control of the SS and CS pins
between the RFM12 and the SD card. And as noted before, the SS pin always has
to be configured as output, whether it's used or not.

Also, of course, RFM12 comms will not work properly unless an interrupt is used,
so that needs be treated properly in the RFM12 code too.

EDIT: I assume you also assign different node IDs to the 2 different modules,
meaning modify the sketch between Arduino boards.
Correct, I'm using totally different sketch for transmitter (attaching if you interested).
You gave a good idea about setting SS as high, that could be the issue.  So I need to set that port to high (i.e. DigitalWrite(SS_PIN,HIGH) in order to start using it?  
But let's forget for a minute RF12B. I'm trying an SD card code only (i.e. quickstart sketch from SDFat library) and it just doesn't work... So even if I'm not invoking RF12b in any way in the code it somehow still interferes on hardware level?

..what about the SPI speed?? It could happen the SDdriver sets it to a freq RFM does not like and vice versa..based on the board variant..
Again even when I'm totally ignore RF12b module in software (not including libraries, etc), why wouldn't SD card still work?

I'm thinking for adding pullup resistor to RF12b just in case and if that doesn't work I'll solder another board and not attach RF12b components to it, just SD card parts and see if it helps...

BTW I really appreciate you guys trying to help me!  At least I have some hope now smiley
152  Using Arduino / Motors, Mechanics, and Power / Most silent motor out there on: May 06, 2013, 01:47:42 pm
I'm on a quest to make a small electric toy for my cats that will just run/crawl around the house. I've went thru tons of similar toys form Radioshack, etc. and they all have one big problem. Motors in them is freakishly noisy, even in tiny toys size of thumb.  It scares cats.  
Is there a small low power motor that's almost totally silent?  Can you recommend me one? smiley  Not sure if best would be stepper, geared or servo...
153  Using Arduino / Microcontrollers / Re: ATMega1284p issues with SD Card on: May 06, 2013, 01:01:29 pm
bratan, getting back to the original problem, have you ever gotten the
RFM12s to work with any Arduino chip at all? Also, which library and sketches
are you using?
 
If you're using the jeelib s.w., from my experience, none of the sketches work
correctly, including the demo sketch. I only ever got the RFM12s to work by
using the sketches shown in the Arduino Cookbook.
Yes in fact I only got it working using ATMega1284 running  "Mighty 1284p 16Mhz w/ Optiboot". I ran it as a reciever, sketch is below (it uses Felix's RFM12B library which is derivative of Jeelib's but much better). I modified library slightly to include 1284p pin definition, because it only had 644p.
Code:
// Simple serial pass through program
// It initializes the RFM12B radio with optional encryption and passes through any valid messages to the serial port
// felix@lowpowerlab.com

#include <RFM12B.h>

// You will need to initialize the radio by telling it what ID it has and what network it's on
// The NodeID takes values from 1-127, 0 is reserved for sending broadcast messages (send to all nodes)
// The Network ID takes values from 0-255
// By default the SPI-SS line used is D10 on Atmega328. You can change it by calling .SetCS(pin) where pin can be {8,9,10}
#define NODEID           1  //network ID used for this unit
#define NETWORKID       1  //the network ID we are on
#define SERIAL_BAUD 115200

#define LED_ID 23 // Pin for LED indicator
//encryption is OPTIONAL

// Need an instance of the Radio Module
RFM12B radio;
void setup()
{
   Serial.begin(SERIAL_BAUD);
  pinMode(LED_ID, OUTPUT); // Turn on LED port for output
  Serial.println ("Initializing Radio");
  radio.Initialize(NODEID, RF12_915MHZ, NETWORKID);
 // radio.Encrypt(KEY);      //comment this out to disable encryption
 
  Serial.println("Listening...");
}

void loop()
{
  if (radio.ReceiveComplete())
  {
    digitalWrite(LED_ID,HIGH); // Turn on LED
    if (radio.CRCPass())
    {
      Serial.print('[');Serial.print(radio.GetSender());Serial.print("] ");
      for (byte i = 0; i < *radio.DataLen; i++) //can also use radio.GetDataLen() if you don't like pointers
        Serial.print((char)radio.Data[i]);

      if (radio.ACKRequested())
      {
        radio.SendACK();
        Serial.print(" - ACK sent");
      }
    }
    else
      Serial.print("BAD-CRC");
    
    Serial.println();
    delay (10);
    digitalWrite(LED_ID,LOW); // Turn of LED
  }
}

I have Moteino setup as trasmitter and it's hooked up to DS18B20 temp sensor (on breadboard) and transmits temperature readings. Setup works like a charm. But as I said with Mighty 1284p boot SD card stops working. With Sanguino SD card works but RF12B doesn't work...
154  Using Arduino / Microcontrollers / Re: ATMega1284p issues with SD Card on: May 06, 2013, 07:11:45 am
What does this have to do with Bobuino? Nothing that I can see.  I request you take Bobuino out of the title.
Hmm ok I removed it. But question was relevant and about Bobuino as well as other variants of 1284p bootloaders, and why they don't work with SD card while Sanguino version did on my version of hardware... Was hoping to get some hints, this was not meant to critique your variant smiley
155  Using Arduino / Microcontrollers / Re: ATMega1284p issues with SD Card on: May 05, 2013, 10:55:36 pm
To OP, I think your ckt is ok, as is. The problem may be that, when you use the SPI peripheral with -CS
other than the standard SS pin, you still need to set the SS pin = OUTPUT, else the peripheral will revert
to slave mode.

Thanks, I will keep looking for a solution. It's very helpful to at least eliminate hardware as source of the issue smiley
As to SD card voltage (to the person who hijacked my thread smiley , I'm not an expert but from what I've learned in the past year, every circuit I've seen uses 3.3V for regular SD cards, no exceptions... And from posted specs in voltage range of 2.7 - 3.6V, 3.3V seems like a sweet spot smiley
156  Using Arduino / Microcontrollers / Re: ATMega1284p issues with SD Card on: May 05, 2013, 11:59:02 am
..have a look on the pin definitions in "pins_aruino.h" and do check the stuff around:
Code:
..
static const uint8_t SS   = 4;
static const uint8_t MOSI = 5;
static const uint8_t MISO = 6;
static const uint8_t SCK  = 7;
..

Tried changing it, but no difference. In fact I'm surprised that SS is defined like that, it can be any pin...
BTW speaking of powering whole thing at 3.3V I realized that my DC1307 chip requires 5V.  Do you know if it will operate with 3.3V logic if I connect it to 5V VCC?
157  Using Arduino / Microcontrollers / Re: ATMega1284p issues with SD Card on: May 05, 2013, 10:52:29 am
..I would not mess with those HC125 drivers as the 1284p runs fine at 3.3V/16MHz..
Hmm, that's true... I guess I can redesign the board, since I already have 3V reg. I only need 5V to drive LED matrix...
Thanks.

P.S. It seems issue with pin definitions somehow... I tried these bootloaders on same 1284p chip and here's result:
  • Mighty 1284 w/ Optiboot: RF12B Module works. SD card doesn't work
  • Bobuino: RF12B Module Doesn't work (I know I stated in my OP that it worked, but I was wrong). SD Card Doesn't work
  • Sanguino  1284 : RF12B Module doesn't work. SD Card WORKS!  
How do I get both working? smiley-sad
158  Using Arduino / Microcontrollers / ATMega1284p issues with SD Card on: May 05, 2013, 10:14:55 am
I just finished building new prototype (V2) for my xronos clock, this one has audio/microSD card and RF12B receiver on board. However I'm having a strange issue. With ATMega644p (Sanguino) almost everything works, microSD is read normally, but RF12B is not working. Knowing how buggy Sanguino is, I installed ATMega1284p chip (Bobuino) and now SD card is not working at all smiley-sad  (RF12B is working).
Now the most strange thing is when I take this same 1284p chip and put it into my V1 board (that has WaveShield connected as shield, but no RF12B) it can read SD card!
 smiley-eek
I have no clue what to look for. If problem is in my hardware, then why 644p can read SD card. If it's software then why 1284p works on another board (where I have same exact IC pins connected to WaveShield)...
Is RF12B connected to same SPI as SD card interfere somehow? I'm using different CS pins for each.  Any suggestions? smiley
159  Using Arduino / Project Guidance / Re: File Allocaiton Table from scratch on: April 26, 2013, 09:05:48 pm
Maybe an article from someone who recreated FAT from scratch?

Wouldn't it make more sense to use the existing SD FAT lib?
yes I plan to use it for reading, but how to create FAT in the first place? It's not SD card, I can't plug it into computer and format it smiley
160  Using Arduino / Project Guidance / File Allocaiton Table from scratch on: April 26, 2013, 08:27:24 pm
I want to try and create FAT16 and sector map on SPI flash IC (wasn't able to find if anyone done it before). Could someone recommend me a source for detailed (i.e. white paper) information about FAT16?  Maybe an article from someone who recreated FAT from scratch?
161  Using Arduino / General Electronics / Re: SPI Flash capacity and speed on: April 26, 2013, 03:12:21 pm
You probably want this part, instead of the other, which sells in qty = 1800.
http://www.digikey.com/product-detail/en/N25Q128A13ESE40E/557-1562-ND/3874288
Yes smiley oops
108Mhz is the max clock speed, and they usually run at slower speeds. Also, notice these
are 3.3V parts, so you'll need level-shifters to interface with 5V Arduino. Most Flash chips
I've seen are 3.3V, and not 5V, devices.
Oh yeah I know that, it's same as SD card smiley
162  Using Arduino / General Electronics / Re: SPI Flash capacity and speed on: April 26, 2013, 03:01:13 pm
Looks like an interesting chip.
Supports DC to 90-108MHz operation - best you can do with SPI is 8 MHz, about 1 byte transmitted per microsecond if you can do burst of SPI transfers with no looping.
(I posted code recently that sends out 41 bytes in ~46uS from an array, added 12uS to loop thru it).
Since you have to provide at least the starting address of the locations you want to read from & write to, vs a file name associated with an SD card file, I don't see how the waveshield library will help.
Oh I didn't know about that smiley I wonder if it can formatted like SD card?
163  Using Arduino / General Electronics / Re: SPI Flash capacity and speed on: April 26, 2013, 02:12:00 pm
8 bits = 1 byte

will 108Mhz flash work with Arduinoish ATMega MCUs that runnin at 16 Mhz?

Yes.

Thanks!  One more question, does Serial Flash IC (i.e. something like this)  have speed comparable to regular SD Cards?  I wanted to see if it's feasible to read WAV files from flash IC with WaveShield library...
164  Using Arduino / General Electronics / SPI Flash capacity and speed on: April 26, 2013, 01:10:41 pm
You'll laugh, but I just found about SPI Flash and how cheap it is comparing to the microSD cards (if you need only about 10 Megabytes of data stored).
So please forgive my n00bness but I'm a little confused about capacity specs of flash. It seems to be specified in Megabits, not megabytes. I thought Megabits were reserved for measurement of speed not capacity?  Will 128 Megabit flash give me 16 Megabytes of storage or am I confusing specs?
Should I worry about SPI Flash speed specs?  i.e. will 108Mhz flash work with Arduinoish ATMega MCUs that runnin at 16 Mhz?
165  Using Arduino / Programming Questions / Re: Why map() returns negative number? on: April 24, 2013, 08:54:49 am
Quote
So something like this should fix the issue, right?
Yeah, but...

Code:
lightLevel = analogRead(photoCellPin);
lightLevel = constrain(lightLevel, PHOTOCELL_MIN, PHOTOCELL_MAX);
lightLevel = map(lightLevel, PHOTOCELL_MIN, PHOTOCELL_MAX, 1, 5);
would be a lot easier to debug. You can print lightLevel at each step to make sure that it is read, constrained, and mapped correctly.
Thanks! smiley Yeah it's much easier to read, but now my lightLevel var will have to be int, so I'm wasting a byte smiley
It works now tho!  If anyone interested here's the code. I had to do a little trick to prevent clock from flickering. Basically it only changes brightness if it it's different from previous reading, plus it takes readings only every 10 seconds (aprox)...

Code:
void autoBrightness () {
  if (brightness) return; // Brightness is not set to 0 (auto)
  if (second()%10) return; // Take readings every 10th second only
  if (prevBrightness==0) {  // Initialized previous Brightness setting only if Brightness was reset
      prevBrightness=map( constrain (analogRead(photoCellPin), PHOTOCELL_MIN, PHOTOCELL_MAX), PHOTOCELL_MIN, PHOTOCELL_MAX, 1, 5); // Get Ambient Light Reading
    setBrightness(prevBrightness); // Set LED brightness
  }
  lightLevel = map( constrain (analogRead(photoCellPin), PHOTOCELL_MIN, PHOTOCELL_MAX), PHOTOCELL_MIN, PHOTOCELL_MAX, 1, 5); // Get Ambient Light Reading
  if (lightLevel != prevBrightness) { // Set LED brightness only if light changed
    setBrightness(lightLevel);
    prevBrightness=lightLevel;
    //Serial.println (lightLevel);
   }
}

Full sketch here
Pages: 1 ... 9 10 [11] 12 13 ... 25