Show Posts
Pages: 1 ... 68 69 [70] 71 72 ... 100
1036  Using Arduino / Sensors / Re: AC adapter for use with sensors on: February 27, 2012, 10:29:47 am
After a search I found this three prong 9V adapter

I have ordered one and will post an evaluation after it arrives.
1037  Development / Other Software Development / Re: Modular API on: February 27, 2012, 09:22:24 am
Your idea of using interrupts for 'hardware accelerated' 'threading' is forty years old.  That's how we wrote embedded systems in the 1970s. We wrote a custom threading framework for each system and often a custom disk driver and other subsystems.

It became apparent that a more general approach would be better. This lead to the modern RTOS.  My friends founded Wind River Systems and produced VxWorks in the early 1980s.  VxWorks is still very popular and has been used in many major projects like the Mars Rovers.

The main reason people experience a lot of overhead using a RTOS is lack of knowledge/experience in good embedded system design and misuse of RTOS features.

There are a number of choices for Arduino.  If you want a state machine try QP from Quantum Leaps

For true preemptive multitasking on Arduino I like ChibiOS/RT.  I have ported it as a library here  The current version is .

I have also tried FreeRTOS but it is not as efficient as ChibiOS/RT on Arduinos.  I also ported FreeRTOS as a library and a trial version is  at
1038  Using Arduino / Sensors / AC adapter for use with sensors on: February 24, 2012, 08:50:35 am
Does anyone know of a source for a small U.S. style three prong AC to 9VDC adapter to power Arduino boards.  It should have a 2.1 mm barrel connector.

I would like the AC ground prong connected to negative DC.  This is how larger three prong adapters work with devices like notebook computers.

Common two prong 9V adapters are isolated from AC but "float" with almost 50 VAC if you put a scope probe on the barrel.  This means it is necessary to ground the Arduino for many sensor applications.

Providing a ground is often a pain and a three prong grounded AC adapter would be much better.

I have even found that touching the USB connector on the Arduino board can cause I2C errors when it is powered by a two prong adapter.

I used an Uno with an Adafruit Data logging shield for tests.  I powered the Arduino with a 9V two prong adapter.

I touched the outer part of the USB connector with a ground wire several time and the following sketch fails with an I2C error, red LED lit, after an average of ten touches.
#include <Wire.h>
#include <RTClib.h>

uint8_t const GRN_LED_PIN = 2;
uint8_t const RED_LED_PIN = 3;


DateTime now;

int32_t lastTime;

void setup() {
  now =;
  lastTime = now.unixtime();
void loop() {
  int32_t t;
  do {
    now =;
    t = now.unixtime();
  } while (t == lastTime);
  if ((t - lastTime) != 1) {
    digitalWrite(RED_LED_PIN, HIGH);
  lastTime = t;
  digitalWrite(GRN_LED_PIN, t & 1);
1039  Development / Other Software Development / ChibiOS/RT 2.4.0 RTOS update on: February 21, 2012, 10:39:49 am
I have updated the ChibiOS/RT library to version 2.4.0.

This library is a simple way to use the ChibiOS/RT RTOS on 328 and Mega Arduinos.

The download is at

The main new thing for AVR is support for pal (digital I/O).  If you want to try this edit halconfig.h and change line 47 to this.
#define HAL_USE_PAL                 TRUE
I have not tested pal, just checked that it compiles with the above define.  A lot of edits will be required since the default board is a Olimex AVR-MT-128 proto board.

There are a huge number of internal changes.  The diff between 2.2.8 and 2.4.0 versions of the utility folder in the Arduino library has 4739 lines.

There are a lot of new files.  Most of the new files are for features not supported for AVR

1040  Development / Other Software Development / Re: ChibiOS/RT 2.2.8 RTOS update on: February 20, 2012, 08:33:10 pm
I will look at 2.4.  It has a lot of new stuff for ARM but AVR may not be hard to port to Arduino.
1041  Development / Other Software Development / Re: Fast alternative to digitalRead/digitalWrite on: February 19, 2012, 10:15:48 pm
I know the beta has problems like the 'struct pin_map_t' error. 

I am not happy with the beta and have totally restructured this library but have not had time to finish the new library.

The old version did not work well for a number of applications like fast software I2C and SPI.  The new library is very different and won't be backward compatible.
1042  Development / Other Software Development / Re: An alternative Serial Library for Arduino 1.0 on: February 18, 2012, 09:45:56 am
A number of libraries access Serial.  This causes HardwareSerial to be loaded even if you don't call the functions that access Serial.  These libraries can't be used with SerialPort.

All released SD.h and SdFat libraries cause HardwareSerial to be loaded and can't be used with SerialPort.  I will soon release a version of SdFat that does not access HardwareSerial. 

A beta version of this SdFat is in here
1043  Using Arduino / Storage / Re: libellium modul work only with Kingston microSD 2gb SDC on: February 10, 2012, 09:22:20 am
The Libelium MicroSD module uses resistors for level shifters and many SD cards won't work with it.

The problem is that resistor level shifters do not provide fast enough rise times for the SPI signals and cards that use edge detectors often fail with this module.
1044  Using Arduino / Storage / Re: 32U4 microSD interface issues with Arduino 1.0 & SD/SDfat on: February 09, 2012, 06:20:55 pm
I wrote SdFat and defined a 32u4 to be a Teensy long before the Leonardo was planned.  I will support the Leonardo in the future.

SdFat and SD.h which is a wrapper for an old version of SdFat assume a 32U4 is a Teensy.  It is unlikely that the SPI pins will be initialized correctly for your setup.
1045  Using Arduino / Storage / Re: Logging to SD file size limit? on: February 08, 2012, 10:06:00 am
I am amazed your setup works at all.  You need to clean up your wiring so the SD is close to the CPU and use very short wires for SPI.

The version of SD.h included with 0022 opens files with the O_SYNC flag so there is an incredible amount of I/O to the card. 

Also opening and closing the file for each data point causes more I/O as the file grows since open does a seek to the end-of-file.

I/O to the card is done in 512 byte blocks and a sync call requires at least 2048 byte of I/O.  I suspect you are doing over 50,000 bytes of I/O to the SD for each data point.
1046  Using Arduino / Storage / Re: SD Card list files to HTML strange output on: February 03, 2012, 09:32:57 am
You have a number of problems with print date and size. 
  if (0 & LS_DATE)
  if (!DIR_IS_SUBDIR(&p) && (0 & LS_SIZE))
will always be false so the date and size will not be printed.

The code was derived from SdFat's ls() which had an options flag in place of the zero like this:
if (flags & LS_DATE)
if (!DIR_IS_SUBDIR(&dir) && (flags & LS_SIZE))

will not print a date.  lastWriteDate is the date in a 16-bit packed DOS format.  SdFat prints the date with this function:
void SdBaseFile::printFatDate(Print* pr, uint16_t fatDate) {
  print2u(pr, FAT_MONTH(fatDate));
  print2u(pr, FAT_DAY(fatDate));

will not print the fileSize.  fileSize is a 32-bit unsigned so here you need print like this:
1047  Using Arduino / Storage / Re: sdfat vs. sd on: February 02, 2012, 08:09:45 pm
I am the author of SdFat.  SD.h is a wrapper for an old version of SdFat that provides an alternative API.

SD.h works well for most people.  It has bugs but these don't affect most people.  Most users don't need the features or higher performance of SdFat so SD.h will probably work fine for you.

So the SD library included with the Arduino IDE is SdFat with a simple API that reduces features but makes the library easy to understand and use.  The new SdFat is also easy to use for simple sketches but has a different API.
1048  Development / Other Software Development / Re: Small SD card code? on: February 02, 2012, 06:03:26 pm
A new version of SdBoot is attached to this reply.  You must be logged in to download the the attachment.

I fixed a couple of bugs.  The most serious bug required a major change to avoid a 32-bit multiply and the increase in flash size.

I added a number of configuration options and improved error handling.  I managed to limit the size increase to six bytes by optimizing several areas.

The options such as chip select pin can be set by editing SdBootConfig.h.
1049  Development / Other Software Development / Re: Small SD card code? on: February 01, 2012, 06:08:22 pm
I have tested the sketches with an Enet shield which has pin 4 as SD chip select.  The sketches are designed to disable the Enet SPI part which uses pin 10 as chip select.

This code currently works only on 168/328 Arduinos.

In writeTest change init to this:
  if (!sd.init(4)) {
To run readTest edit SdBoot.cpp and change the chip select defs like this:
// use pin 4 for chip select
#define CS_DDR DDRD
uint8_t const CS_BIT = 4;
Remember this is not well tested code.  I am trying to help westfw and hope he will pursue an SD boot loader.

File names are always eleven bytes, alpha are caps.

The first eight bytes contain the file name with blank fill.

The last three bytes contain the file extension with blank fill.
1050  Development / Other Software Development / Re: Small SD card code? on: February 01, 2012, 04:38:44 pm

The library is an attachment to the message with the readme.txt quote.  You must be logged in to see it.
Pages: 1 ... 68 69 [70] 71 72 ... 100