Offline
Jr. Member
Karma: 0
Posts: 92
|
 |
« on: February 06, 2013, 10:10:24 am » |
Hi, I'm doing some home automation stuff and sensor reading with some Arduinos. I bought a Nano for the bathroom and now I'm scared that the 32 KB are not enough. I chose the Nano cause it's easy to integrate him into the PCB. I have just the code i posted here now on it: http://arduino.cc/forum/index.php/topic,141240.msg1105074.html#msg1105074So 14 KB are already gone. But i want to see life data of my sensors on the web page, save data to the SD-Card and upload them to the servers database. This is what was planned: D2 S0-Interface Electricity Meter Bathroom Underfloor heating D3 S0-Interface Electricity Meter D5 One Wire BUS (1 DS18B20) D6 Flow Sensor Bathroom Sink Cold D7 Flow Sensor Bathroom Sink Hot D8 Flow Sensor Shower D9 Flow Sensor Toilette A0 (14) Reed Switch Bathroom Window A1 (15) Push Switch 1 (Shower On) A2 (16) Push Switch 2 (Shower Off) A3 (17) Push Switch 3 (Bathroom On) A4 (18) Push Switch 4 (Bathroom Off) A5 (19) Push Switch 5 (Bathroom On) A6 (20) Push Switch 6 (Bathroom Off) The push switch stuff is send trough my Windows server with MQTT to another Arduino and later i also want to change the code so that i can dime the lights. Looks like 32 KB is not enough and i need a Mega? PS: Is it a good idea to start one thread for the whole project instead of spreading the stuff where i need help and have problems over the forum? Cause this way all the code is in one place and i do not need to copy it around and always need to explain what the rest of the code does that has nothing to do with a particular thread.
|
|
|
|
|
Logged
|
|
|
|
|
Queens, New York
Offline
Edison Member
Karma: 29
Posts: 1569
"Of all the things I've ever lost, I miss my mind the most" -Ozzy Osbourne
|
 |
« Reply #1 on: February 06, 2013, 10:54:14 am » |
If you know it does compile and it doesn't upload, then it doesn't have enough memory.
|
|
|
|
|
Logged
|
UNO, MEGA, NANO, 4x4 keypad, micro servos, RF transceivers, bluetooth, ultrasonic sensor, 20x4 I2C LCD, 3.2 TFT touch screen, L298N Dual motor driver, Voice Recognition 15W, Gameduino
Arduino Tutorials, coming soon.
"If your doing nothing, it does not mean your lazy, it just means your open for anything that suits you" - Unknown
|
|
|
|
Offline
God Member
Karma: 27
Posts: 827
|
 |
« Reply #2 on: February 06, 2013, 11:05:36 am » |
PS: Is it a good idea to start one thread for the whole project instead of spreading the stuff where i need help and have problems over the forum? Cause this way all the code is in one place and i do not need to copy it around and always need to explain what the rest of the code does that has nothing to do with a particular thread.
Well, from my own personal experience, posting your entire project in one thread results in people not reading it and just asking you questions that are answered in your post to begin with. But, on the other hand, if you post only snippets, people will ask you to describe your entire project. Unfortunately, that's just the way it goes on forums. *I* prefer to have (and read) it all in a single thread. If I am interested or I think I can help, I bother to read the entire thing. If I am not or can't, then I don't. You also run into the fact that people may not keep coming back to your thread to see that you've asked new questions when it is all in one place. So, I don't really have an answer. Only my preference. If there is a better way, I would love to hear it, because I have asked the same question myself. What I do in some cases is post a thread about my entire project as a whole, and then post other threads asking specific questions. When people ask me to describe the project, I refer them to the other thread.
|
|
|
|
« Last Edit: February 06, 2013, 11:17:45 am by Retroplayer »
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 15
|
 |
« Reply #3 on: February 06, 2013, 11:07:54 am » |
in order to save memory... make the function compress...
|
|
|
|
|
Logged
|
|
|
|
|
North Queensland, Australia
Offline
Edison Member
Karma: 31
Posts: 1182
|
 |
« Reply #4 on: February 06, 2013, 11:09:26 am » |
Depends what your coding skills are like really, memory ( SRAM ) is an important issue, but 32kb to an experienced coder is quite significant. It doesn't help if 3rd party code takes up a large chunk of flash, but you can utilise many devices efficiently if planned out optimally.
There are also ways to see the static memory usage, ( 'avr-nm.exe -S' will give some info. )
|
|
|
|
|
Logged
|
|
|
|
|
UK
Offline
Tesla Member
Karma: 89
Posts: 6388
-
|
 |
« Reply #5 on: February 06, 2013, 11:28:02 am » |
I don't know what the interface to your electricity meter will be like, but everything else you're doing seems fairly straight forward. I doubt that program space will be a problem. RAM is a separate issue, and you would need to know how much RAM your Nano variant has and what data structures your sketch will need in order to estimate the RAM requirements.
Given a project of this complexity it would be sensible to implement it in small steps, adding functionality as you go. With that approach you can be confident that the early versions will fit in the available program and RAM space, and measure how much they're actually using as the sketch evolves to see whether you're approaching a problem.
I suggest that the best way to get help is to only post when you have a specific problem or question that you want help with, and provide as much detail as is necessary to understand that problem or question. Anything involving software will almost always involve posting your whole sketch, but you can help a lot by doing some work in advance to reproduce the problem or question in isolation in a much smaller and simpler sketch. This will help your own understanding of the problem too, and quite likely you'll find that the act of reproducing the problem in a minimal environment reveals a false assumption or mistake in your understanding which enables you to solve the problem on your own.
|
|
|
|
|
Logged
|
|
|
|
|
Central MN, USA
Online
Faraday Member
Karma: 35
Posts: 5929
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
|
 |
« Reply #6 on: February 06, 2013, 12:44:39 pm » |
|
|
|
|
|
Logged
|
|
|
|
|
Dee Why NSW
Offline
God Member
Karma: 11
Posts: 518
|
 |
« Reply #7 on: February 06, 2013, 06:53:24 pm » |
Get the Mega. It's not much more expensive.
You can do an awful lot with the Uno provided that it is a lot of the same job. You are doing different jobs. That changes things immediately and the problems are beyond your control. Different things to be done require different libraries, and that is where the memory goes.
I can see two new libraries coming over the hill, SD and RTC. My stuff is sent to cosm for live view on the internet. In my case the cosm library was the straw that broke the camel's back, and I was obliged to move to Mega 2560.
I think it would be fair to say that, if you want to have a proper system sending data the to internet, a Uno will not suffice. It may be that some smart operators can squeeze it all in by stripping down the libraries. I have no idea about that, but I'm sure you can come to your own conclusions about the merits of such an approach.
|
|
|
|
|
Logged
|
|
|
|
|
Offline
God Member
Karma: 27
Posts: 827
|
 |
« Reply #8 on: February 06, 2013, 07:16:18 pm » |
Get the Mega. It's not much more expensive.
I actually bought my Mega2560 on ebay for $17 shipped. Less than I paid for my Uno. It probably isn't "official" even though they even screen-printed it all official, but it has been working fine.
|
|
|
|
|
Logged
|
|
|
|
|
Central MN, USA
Online
Faraday Member
Karma: 35
Posts: 5929
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
|
 |
« Reply #9 on: February 06, 2013, 08:36:15 pm » |
I can see two new libraries coming over the hill, SD and RTC.
I failed to notice the SD lib was mentioned, right in the OP. I tested it once that it takes about 1.5 KB SRAM.
|
|
|
|
|
Logged
|
|
|
|
|
Dee Why NSW
Offline
God Member
Karma: 11
Posts: 518
|
 |
« Reply #10 on: February 07, 2013, 01:15:47 am » |
Well I did say coming over the hill. And when it arrives, you can be fairly sure that the code that uses it is soon to follow. It's a minor stretch of the intellect, sometimes known as forward planning. If you buy a Uno for the purposes stated and then come to regret it, remember where you heard it first.
|
|
|
|
« Last Edit: February 07, 2013, 01:28:49 am by Nick_Pyner »
|
Logged
|
|
|
|
|
Dee Why NSW
Offline
God Member
Karma: 11
Posts: 518
|
 |
« Reply #11 on: February 07, 2013, 01:27:53 am » |
Get the Mega. It's not much more expensive.
I actually bought my Mega2560 on ebay for $17 shipped. Less than I paid for my Uno. It probably isn't "official" even though they even screen-printed it all official, but it has been working fine. Yes, Retro. I paid about $70 for my store-bought EtherTen. My Mega with Ethernet+SD shield was about $27, I think. I don't regret getting the EtherTen, but it's the sort of thing you only do once. I think type-for-type a Mega is typically about $10 more than a Uno, and that seems reasonable. The only advantage a Uno has is its size, and I imagine it will be squeezed from both ends and die a natural death - rather like the VIC-20.
|
|
|
|
« Last Edit: February 07, 2013, 01:41:27 am by Nick_Pyner »
|
Logged
|
|
|
|
|
Central MN, USA
Online
Faraday Member
Karma: 35
Posts: 5929
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
|
 |
« Reply #12 on: February 07, 2013, 01:39:07 am » |
I don't think so. UNO has it place and will keep its place. A carefully planned project such as on I carried out, did accomplish a lot with the SD card, RTC, and a few other things and extensive menu interface, all on an UNO. I'm not saying anyone else can easily pull this off. 
|
|
|
|
|
Logged
|
|
|
|
|
North Queensland, Australia
Offline
Edison Member
Karma: 31
Posts: 1182
|
 |
« Reply #13 on: February 07, 2013, 02:05:48 am » |
The only advantage a Uno has is its size, and I imagine it will be squeezed from both ends and die a natural death As liudr said, the Uno ( 328, 168 chips ) certainly have their place. Code will actually execute faster on an UNO, you pay a price for the convenience the 2560 provides.
|
|
|
|
|
Logged
|
|
|
|
|
Dee Why NSW
Offline
God Member
Karma: 11
Posts: 518
|
 |
« Reply #14 on: February 07, 2013, 02:41:38 am » |
The faster execution has not been evident in practice, and I doubt the OP will see it either. Convenience is hardly the word for it. The difference between being able to do the job and not being able to do the job is not a matter of convenience, it's a matter of having the right tool.
And, despite liudr's self-aggrandisement, I submit that the Uno is the wrong tool for the job or, even if it is OK now, it will be wrong soon enough.
So, in the light of the OP having no more gold stars than I do, and the minor extra cost, he/she would be wiser not to bother with a Uno.
|
|
|
|
|
Logged
|
|
|
|
|
|