Development using Arduino...

Hello Everyone,
I have used arduino in the past for my hobbies, albeit, not to a great extent. My purpose this time around is quite different.

My final objective is to use atmega**** on my own board. I have a few questions regarding that:

  1. how feasible is it to use an arduino board for initial project kickstart purpose (till I finalize and make my own board)
  2. how portable will the code be from the arduino board to my own board?
  3. can I use arduino libraries?
  4. are there any restrictions on using arduino libraries on commercial boards?

I am specifically looking at atmega2560 (mega pro 3.3/5), but haven't settled on it. Making this decision mostly for the flash size and low 'Power-down' current consumption with RTC enabled, and also for its 4k onboard eeprom.

Appreciate any help/advice I can get on it. Thanks.

1/ It's feasible. If your proposed custom hardware includes any additional devices then you'd need to connect your Arduino to these for it to work.
2/ The code will be entirely portable as long as you keep the hardware connections between the chip and your other devices consistent. If your Arduino board is based on a different microcontroller chip than your evntual custom board then you would need to stick to the public API to the Arduino runtime library and avoid direct access to hardware registers and so on.
3/ Yes.
4/ Yes, but it's allowable as long as you comply with the Arduino license terms.

You haven't said much about your custom board, but if you haven't already done so I suggest you search for clones doing the same sort of thing you want - there are lots of very specialised clones out there. There are also lots of custom boards already designed at batchpcb, and there may be other fab companies that support that type of thing.

'1284P has same 4K EEPROM, but also 16K SRAM - twice the Mega - and is quite a few dollars less. Can be had in DIP or surface mount format.
I have made several boards with it. You might pick one of those up for development.
http://www.crossroadsfencing.com/BobuinoRev17/
$6 for bare board mailed to US locations. PL & Schematics at link above.

Thanks for the reply guys!

PeterH, I will be expecting to have the same controller for my target board as the arduino board, but I get your point. Sometimes things can change as the project progresses. As regards to the arduino license, I was hoping that someone can put it in layman terms for me, since I'm not conversant with the license and I'm not a lawyer :slight_smile:

The 1284 certainly seems like a good option. My only concern is running out of space, So I'd like to have 256k.

One point that I forgot to mention in my post, is that I also hope to implement pc connectivity via USB, to access data stored in the EEPROM.

Since PeterH asked, I'll elaborate a little on my project. It's a classic gather real time sensor info, display on a graphic LCD, and store in the EEPROM (which like I mentioned will be accessed via the pc). There will be setteble alarm thresholds. The settings will all be menu driven, so there will be as much as 4-6 keys, to manoeuvre through them.

What other pointers can you guys give me? How can I implement the pc connectivity? (Not looking for a tutorial, but some advise/links/opinions) As far as I understand it, I'll have to use ftdi, since these processors are not native usb.

Thanks again!

My sensor output is going to be pluses, so ill be using a timer to process them.

Also, any comments on the processor choice given all the additional info?

The 1284 board I showed uses FTDI based MIKROE-483 from Mouser for on-board USB, or an offboard FTDI module like FTDI Basic, CP2102 module, etc.

Is using an ftdi fairly straight forward? is it plug and play so to speak? I mean i know that you'd have to interface with it in code, but anything else beyond that?

I also need to store about 1000 float values on the EEPROM. The reading will range from 0 to 10,000. So if i'm storing float values, then would it be safe to assume that I'd need: 1000 x 4 = 4K size EEPROM?

Anyone?

Patience grasshopper. Some of us have day jobs.

maverickpilot:
Is using an ftdi fairly straight forward?

Yes.

is it plug and play so to speak?

Yes.

I mean i know that you'd have to interface with it in code, but anything else beyond that?

The board is presented to the computer as a standard serial port. Just like most other Arduino (and compatible) boards.

I also need to store about 1000 float values on the EEPROM. The reading will range from 0 to 10,000. So if i'm storing float values...

Have you considered storing fixed-point values instead?

...then would it be safe to assume that I'd need: 1000 x 4 = 4K size EEPROM?

Exactly.

Sorry Coding, got a little anxious there :slight_smile:

Thanks for your reply. Storing fixed point would mean that I'd have to multiply everything by 100, and my highest value would be 10,000. I'd have to get into storing doubles then. I also have to store the time of the reading taken.Don't know how i'm going to do that. I'm thinking 4K won't be enough, I might have to get a separate EEPROM IC.

Is there any other way to store fixed point and later convert to float?

maverickpilot:
Storing fixed point would mean that I'd have to multiply everything by 100, and my highest value would be 10,000. I'd have to get into storing doubles then.

Huh?

Is there any other way to store fixed point and later convert to float?

Yes. But you need to state how many decimals you want to store (bearing in mind 10,000 already gives you 4 significant digits and I'm going to make you prove you need any decimals).

I also have to store the time of the reading taken. Don't know how i'm going to do that.

Store offsets from the start time. What do you want the granularity and accuracy to be for the time?

I'm thinking 4K won't be enough, I might have to get a separate EEPROM IC.

They are certainly much cheaper than the time you will spend trying to squeeze the data into 4K.

[quote author=Coding Badly link=topic=152522.msg1147742#msg1147742 date=1362736812]
Huh?[/quote]
Well if I just divide everything by 100 (for two decimals) after retrieving the data then I can store everything as a whole number. I've never used this technique myself, I read about it somewhere.

Yes. But you need to state how many decimals you want to store (bearing in mind 10,000 already gives you 4 significant digits and I'm going to make you prove you need any decimals).

Ok:
0.01 to 9.99
10.0 to 99.9
no decimal from 100 to 10,000

Store offsets from the start time. What do you want the granularity and accuracy to be for the time?

Down to the second. So for example: reading = 10.15, time = 09:30:54 (hh:mm:ss) and date in dd-mm-yy. Does that answer your question?

They are certainly much cheaper than the time you will spend trying to squeeze the data into 4K.

Ok, so then I've got to add that to my project then.

Ok:
0.01 to 9.99
10.0 to 99.9
no decimal from 100 to 10,000

Which raises the question, what are you reading that gives you 0.01 accuracy over that range?

No negative values?

Which raises the question, what are you reading that gives you 0.01 accuracy over that range?

No negative values?

It's actually a range of the same sensor, but with different resolution levels.

So one sensor will give me a reading from 0.01 to 100, another from 0.1 to 1000, and then lastly 1 to 10,000.

Maybe I'd have to have 3 different versions?

EDIT: No negative values

Only two bytes are needed. Use two bits to indicate the range and the remaining 14 bits to store the value...

0.01 to 9.99 --> value * 100 is stored
10.0 to 99.9 --> value * 10 is stored
no decimal from 100 to 10,000 --> value * 1 is stored

The drawback is the value has to be decoded and you absolutely cannot try to store negative values or values over 16,385 (meaning you need to include the clamps).

This should get you started...

union
{
  typedef struct
  {
    uint16_t range:2;
    uint16_t value:14;
  };
  uint16_t storeThis;
}
cracker_t;

As long as you only write to range / value and only read from storeThis you should be OK with strict aliasing rules.

But what about time stamp?

Also, Why does the Arduino Mega not use FTDI? Is there a limitation there?

maverickpilot:
Also, Why does the Arduino Mega not use FTDI? Is there a limitation there?

It makes the board more versatile. You can reconfigure the board to be different USB devices (e.g. the board can be presented to the computer as a keyboard).

10,000 decimal is only 0x2710, could be stored as an INT.
1000 values only needs 2000 bytes to store.
Then add another INT with # of seconds since start, 65,535 = 1092 minutes = 18 hours. Is that enough?

Does this make the board native USB? So instead of a virtual com port the computer will recognize the board as a USB device? Like when you plug in a digital camera, it'll say "Sony DSCXXX" or when you plug in a phone it'll say the brand and model number?

Can I still use good old FTDI instead?

CrossRoads:
10,000 decimal is only 0x2710, could be stored as an INT.
1000 values only needs 2000 bytes to store.
Then add another INT with # of seconds since start, 65,535 = 1092 minutes = 18 hours. Is that enough?

Actually, no. I need a RTC, that'll display time and date info on the screen at all times. And at the click of a button the current reading should be stored along with the time and date info. It'll be rolling list, so when the user gets to reading number 1000, it would automatically start again from reading number 1.