Show Posts
Pages: [1] 2 3 ... 918
1  Community / Exhibition / Gallery / Re: External EEPROM library for 2k bits - 2M bits on: Today at 01:56:44 pm
Quick look, => decent piece of work.

Two reamrks.4
1)  the code assumes that the wire speed (TWBR) stays the same over multiple writes.
If another I2C device (e.g LCD) / library resets the bus speed, the EEPROM will be affected.

possible way to solve
Code: (dummy)
write(address, value)
{
  int prevTWBR= TWBR;
  TWBR = _TWBR;  // private var in the class

  ... // do your thing

  TWBR = prevTWBR;
}

same for other functions.

To be honest I did not implement in my own eeprom lib
- https://github.com/RobTillaart/Arduino/tree/master/libraries/I2C_EEPROM - smiley-wink

2)
I remember the last Write in micros() to minimize write latency in a different way than you do.
You might take a look at it. - void waitEEReady(); -

2  Topics / Education and Teaching / Re: prospect of a good beginner book on: Today at 01:03:45 pm

There are these books from the openbook project - http://www.ibiblio.org/kuphaldt/electricCircuits/ -
no Arduino but general electronics.
3  Using Arduino / Project Guidance / Re: how to implement IMAGE TO TEXT using ARDUINO MEGA 2560??? on: July 21, 2014, 02:32:42 pm
you can also try to port the tesseract library to Arduino Mega - https://code.google.com/p/tesseract-ocr/ -

Not trivial too, but would be appreciated by many.

How many weeks do you have planned for this project?
4  Using Arduino / Project Guidance / Re: how to implement IMAGE TO TEXT using ARDUINO MEGA 2560??? on: July 21, 2014, 02:30:41 pm
OCR is not one algorithm, it is the collection of all image to text algorithms.

But there are differences, the very high end OCR recognizes written handwriting (banknotes, signature recognition etc)
high end OCR recognizes printed text in most fonts and sizes.
simple OCR recognizes one type of font in one size.

The latter can be done with a MEGA (I programmed a simple OCR long ago on a C64 in Basic so a MEGA must work)

step one: read the image in memory
step two: convert the image to black and white
step three: apply morphological filters to skeletize the text, remove noise, speckles etc
step four: isolate separate characters (and/or words)

iterate of the characters
   step five: draw bounding box around the char
   step six: normalize the bounding box e.g. to a 8x12 bitmap
   step six: compare the bitmap with a collection of bitmaps representing chars
   step seven: output the most likely character

Another way is to implement a neural network and train it with characters. That could replace step six.

Not trivial but definitely doable.
5  Using Arduino / General Electronics / Re: Problem with external eeprom on: July 21, 2014, 02:17:40 pm
no didn't check the datasheet, still,

looking through the thread it appears to me that the OP did not tell the whole story of the application.
The I2C scanner found 8 devices, all EEPROMs? just don't know.

the 8192 value appears to be realistic (power of 2), although yes he does not tell why the number is used.
6  Using Arduino / Programming Questions / Re: Unexpected pow() behaviour on: July 21, 2014, 01:52:07 pm
pow( ) is an almost useless function.   In 30 years of writing C/C++,  I have never found a good reason to use it myself.
Depends on the application, e.g. cuberoot (volume to side)

float cubeRoot(float x)
{
  if (x >= 0) return pow(x, 1/3.0);
  return -pow(abs(x), 1/3.0);
}

or physics formulas like the dew point

Code:
// DEWPOINT
// dewPoint function NOAA
// reference: http://wahiduddin.net/calc/density_algorithms.htm
double dewPoint(double celsius, double humidity)
{
double A0= 373.15/(273.15 + celsius);
double SUM = -7.90298 * (A0-1);
SUM += 5.02808 * log10(A0);
SUM += -1.3816e-7 * (pow(10, (11.344*(1-1/A0)))-1) ;
SUM += 8.1328e-3 * (pow(10,(-3.49149*(A0-1)))-1) ;
SUM += log10(1013.246);
double VP = pow(10, SUM-3) * humidity;
double T = log(VP/0.61078);   // temp var
return (241.88 * T) / (17.558-T);
}
7  Using Arduino / General Electronics / Re: Problem with external eeprom on: July 21, 2014, 01:35:27 pm
Quote
i tryed setting all the slots to 0 , and then i tryed to check how many slots are "0 " or other different value, but it takes about 1 minute to check all the 8192 slots
you could maintain a separate var of the first free slot and update that when it is used.
you can start the search at the last free slot to use the eeprom evenly.

Code: (snippet, not tested)
storeValue(x)
{
 writeToEEPROM (freeslot, x); // store in free place
 // search for first free slot after the current one
 newfreeslot = -1;
 for (int i =1; i < 8192; i++)
 {
    if ( readEEPROM( (freeslot + i )% 8192) == 0)    // start search at last free slot
    {
      newfreeslot = ( freeslot + i) % 8192;
      break;
    }
  }
  freeslot = newfreeslot;
}
8  Using Arduino / Sensors / Re: Soil moisture sensor, very noisy readings on: July 21, 2014, 01:08:07 pm
(a small backgrounder on averaging measurements)

Often a noisy signal is sampled multiple times and averaged with equal weights.

Code: (simple averaging)
int sum = 0;
for (int m=0; m < 16; m++)
{
    sum += analogRead(A0);
}
val = sum/16;

Possible drawback is that as the measurements have a different time stamps, the equal weight per measurement can introduce a systematic error.

To solve this "systematic error" one can add weights to different measurements e.g this average of 5 measurements with an increasing weight, so the last measurement gets most weight. Note the sum of the weights adds up to 100%.
Code: (increased weighted averaging)
sum = analogRead(A0) /16;
sum += analogRead(A0) /16;
sum += analogRead(A0) /8;
sum += analogRead(A0) /4;
sum += analogRead(A0) /2;


Another averaging  scheme gives the largest weight to the middle measurement. 
 
Code: (middle weighted averaging)
sum = analogRead(A0) /16;
sum += analogRead(A0) /16;
sum += analogRead(A0) /8;
sum += analogRead(A0) /2;
sum += analogRead(A0) /8;
sum += analogRead(A0) /16;
sum += analogRead(A0) /16;

Other schemes can be used of course, a generic way to use weights is to place the weights in an array
Code: (weighted average in a loop)
int weight[] = { 6, 3, 3, 6 }; // outer ones are equal the middle two
int sum = 0;
for (int m =0; m < 4; m++)
{
    sum += analogRead(A0) /weight[m];  // sum of the weights add up to 100%
}

Possible drawback of the multiple divisions is the value is truncated with every division. Rounding solves this for most part.
Code: (mwa with rounding)
sum = 0;
for (int m =0; m < 10; m++)
{
    sum += (analogRead(A0) + weight[m]/2) /weight[m];  // sum of the weights add up to 100%
}
9  Using Arduino / Sensors / Re: Soil moisture sensor, very noisy readings on: July 21, 2014, 12:20:37 pm
Averaging assumes the noise consists of values that are too high and values that are too low in approx. equal amount.
by adding the measurements the noise ++ and -- cancels each other out.

The averaging is bit faster if you take a power of 2 as #measurements as the computer can do the divide very fast.
10  Using Arduino / Motors, Mechanics, and Power / Re: Help on the Concepts on: July 20, 2014, 02:19:21 pm
Quote
And note that the current draw of an Arduino is nowhere near half an amp!
from the specs - http://arduino.cc/en/Main/ArduinoBoardUno

Summary

Microcontroller   ATmega328
Operating Voltage   5V
Input Voltage (recommended)   7-12V
Input Voltage (limits)   6-20V
Digital I/O Pins   14 (of which 6 provide PWM output)
Analog Input Pins   6
DC Current per I/O Pin   40 mA

20 pins time 40mA = 800mA  ==> worst case  so my 0.5A was even too low.

OK in practice you seldom get this level but even at 20mA per pin it uses at least 0.4A...

so in the end it depends what you connect to the Arduino..

11  Using Arduino / Displays / Re: A fast PCD8544 library (Nokia 5110) on: July 20, 2014, 02:12:38 pm

len = lcd.print(data);

The F macro is only for data in Flash (readonly code) memory
12  Using Arduino / Microcontrollers / Re: New Mega2560 Layout on: July 20, 2014, 02:11:28 pm
Great idea, would allow for easy replacement of processor.

Quote
Am waffling on pin names tho - go with raw port names like I mostly have now, or go with the IDE names, such as D0,D1, Dxx and A0, A1, Axx?

Go with raw port names, people that will use the " plug in mega " will know the translation
13  Using Arduino / Programming Questions / Re: Problem With Array on: July 20, 2014, 02:06:33 pm
from specs - http://arduino.cc/en/Main/ArduinoBoardProMini -

Microcontroller   ATmega168
Operating Voltage   3.3V or 5V (depending on model)
Input Voltage   3.35 -12 V (3.3V model) or 5 - 12 V (5V model)
Digital I/O Pins   14 (of which 6 provide PWM output)
Analog Input Pins   8
DC Current per I/O Pin   40 mA
Flash Memory   16 KB (of which 2 KB used by bootloader)
SRAM   1 KB
EEPROM   512 bytes
Clock Speed   8 MHz (3.3V model) or 16 MHz (5V model)

no chance to cram 2400 ints in that one (without compression)
14  Using Arduino / Project Guidance / Re: Multiple switches at once / water level meter on: July 20, 2014, 02:03:13 pm
Quote
It seems like some sort of resistor ladder and I can do it with one analog pin.  I know how that works when only one switch at a time will be closed, but how do I work that out here where all of the switches up to a point will be closed. 

then you should use resistors of the same size in the ladder ...

make a drawing and run some scenario's ...
15  General Category / General Discussion / Re: Good career options for arduino enthusiasts, and similar tech minded people? on: July 20, 2014, 01:59:12 pm

in art
in set building for science fiction films
in education
in the internet of things wave that is coming ...
Pages: [1] 2 3 ... 918