Large Firmware Project Guidance

I am looking for suggestions/guidance on the best way to write the firmware for a new board I have made. I come from a computer programming background and electronics has been a long time hobby of mine. I have built a ton of projects and have programmed using Arduino software as well as C for PIC programming etc.

I will have to program using most likely Python for the Raspberry PI part.

So my real question is would I be better programming the ATMEL with something like Atmel Studio or maybe some other tool I have not investigated as of yet. Making a few of the sensors work at a time of course would be easily done but getting all this to work together and smoothly is the challenge.

I built a rather ambitious board. I used a ATMEGA2560 as the processor. It has several Interfaces...
1 XBEE Connector using TXD/RXD as well as a Reset pin for programming ATMEGA remotely
1 Raspberry PI connector using different TXT/RXD plan to use PI as Touchscreen Interface
1 DS3231 RTC in case PI not connected to Internet yet or at all.
2 Sonar (Depth) Sensor inputs - HC-SR04 (Digital Pins)
2 eTape (Depth) Sensor inputs - eTape (Analog Pins)
2 DS18B20 (Temperature) Sensor inputs (Digital Pins)
1 DHT22 (Temperature/Humidity) Sensor input (Digital Pin)
3 Clamp on (Current) Sensors input (Analog Pins)
5 Relays via ULN2803 outputs (Digital Pins)
8 Switch inputs (Digital Pins) (Interupts)
1 Speaker output (PWM Pin)

Yes all the 3.3V - 5V translation was all done. The board is solid. Its the firmware that is going to be challenging.

planning a program

Take a serious look at Cosa. It supports all your interfaces (with possible exception of Xbee), very fast, clean design, true C++ OO implementation, doxygen docs, supports many different boards, and builds with the standard IDE (easy) or makefiles (fast). It's some of the cleanest code I've ever seen. Awesome sauce.

Regarding Atmel Studio: what a bloated, lethargic, archaic hot mess! I knew I was in trouble when the install failed... and then the uninstall failed. It uses an an old version of Visual Studio, so it drags in a ton of MS "stuff". Ask yourself how many projects you've seen that use it. Although you don't need it, some folks liked the USB and CAN support. Those are available from lots of places now.

Cheers,
/dev

tekati:
So my real question is would I be better programming the ATMEL with something like Atmel Studio or maybe some other tool I have not investigated as of yet.

Just use the Arduino IDE to compile and upload code.

However I suggest you use an external text editor (one of the options in Preferences). I use Geany.

You can use the Arduino IDE at the command line so it is possible to compile and upload from Geany (or any other editor with similar options).

You can break a large project into several .ino files or you can use the usual .h and .cpp file system for supporting files.

...R

Robin2:
Just use the Arduino IDE to compile and upload code.

However I suggest you use an external text editor (one of the options in Preferences). I use Geany.

You can use the Arduino IDE at the command line so it is possible to compile and upload from Geany (or any other editor with similar options).

You can break a large project into several .ino files or you can use the usual .h and .cpp file system for supporting files.

...R

My big question I guess at this point is will the Arduino IDE be suitable to make code small enough and fast enough to run everything on this board? It will be used as a Tank Controller to monitor things like heat, pumps, valves and more. I am just afraid that is a lot of work for that processor to start with but getting all that into the code and having it be fast enough and the actual code small enough using the Arduino IDE. Don't get me wrong I understand that the Arduino IDE is simply a C text editor but with a bunch of libraries installed and I guess those libraries are what concern me. I was afraid I would be writing an insane amount of code for the sole purpose of optimizing for code size.

Most people (in my mind) use the Arduino IDE for simple projects that do not require these constraints. I have never really seen any code on GitHub or anywhere else for that matter that really are this large and complex. Most of the time I see people move off to other programming environments. But if you think that the Arduino IDE environment can handle all this I am happy to use it.

I like the idea of using an external text editor such as Geany. Have you ever tried Visual Micro under the full version of Visual Studio? I write a lot in Visual Studio so if Visual Micro is a good solution I might start there. I know it uses the Arduino IDE to compile and upload code as well.

If anyone knows of any really large projects on any sites that are open source please share some links. I would really like to see how large projects are laid out and to get some ideas.

All of your guys guidance in this is very much appreciated.

I would really like to see some links to some larger complex Arduino code projects and or ATMEL processor code projects even with other complier tools. Github links would be great or any links to large projects. The more complex the better but any would be greatly appreciated.

It really helps to see others work especially when starting out on this platform coming from other platforms. It is great to see how other people structure their code. Teams are great too so that we can see some large team projects so we can see how they structure code.

We see examples all the time of code snipets etc but we rarely ever get to see large projects that are in use today.

Even projects that are not finished yet would be very useful.

I to have come from pic chips(crownhill PDS),knowing very little about ardiuno and so far managed to design a 4 channel data logger writing to SD card with time stamp using an RTC and ADS115,with a little menu system for calibrating the voltage readings. A milliohm meter, a break alarm timer and getting 5 arduino's to communicate with each other using the I2C bus with help by asking here.

I would recommend using google there are thousands of full projects and tutorials how to do it. Everyone codes differently this is the best way I found to learn spent plenty of hours/days trolling other people's code and looking at the way they do it also spent plenty of hours trying to get something to work or understand how it works if I get stuck then I'll ask here by posting bits of code you don't understand and others will help/respond.
This way people can see your trying and not doing it the lazy way and not get others to do it for you. My advise is set yourself a little target and build it up like I did with my data logger first I got the rtc code working then the ads115 (ADC converter), then the SD card part(creating a new file either on first power up or via the menu system) and the last thing was the menu system once all where working individually then I started off with the menu code then added rtc to menu code then ADS1115 code and lastly the SD code(building blocks) it's all working now and out in the field been tested so far so good. The next thing I will look at is optimise the code and make it tighter and better.

If you are a little bit sensible then libraries will make your code smaller. You don't get every function in the library downloaded to your Arduino. Only the ones you actually use.

Pumps and valves sounds pretty small. I would think you can do non-trivial programs with 128 or more valves on an Uno. User interface code is usually very bulky.

Steveiboy:
I to have come from pic chips(crownhill PDS),knowing very little about ardiuno and so far managed to design a 4 channel data logger writing to SD card with time stamp using an RTC and ADS115,with a little menu system for calibrating the voltage readings. A milliohm meter, a break alarm timer and getting 5 arduino's to communicate with each other using the I2C bus with help by asking here.

I would recommend using google there are thousands of full projects and tutorials how to do it. Everyone codes differently this is the best way I found to learn spent plenty of hours/days trolling other people's code and looking at the way they do it also spent plenty of hours trying to get something to work or understand how it works if I get stuck then I'll ask here by posting bits of code you don't understand and others will help/respond.
This way people can see your trying and not doing it the lazy way and not get others to do it for you. My advise is set yourself a little target and build it up like I did with my data logger first I got the rtc code working then the ads115 (ADC converter), then the SD card part(creating a new file either on first power up or via the menu system) and the last thing was the menu system once all where working individually then I started off with the menu code then added rtc to menu code then ADS1115 code and lastly the SD code(building blocks) it's all working now and out in the field been tested so far so good. The next thing I will look at is optimise the code and make it tighter and better.

I too came from Crownhill PDS for PIC's. I am not lazy at all. I just believe in doing something right the first time. I have not asked anyone to build anything for me. I just want to see how it is that people structure large amounts of code for these platforms. What I want to avoid is making a large convoluted code structure that is not only hard for others to read but for myself as well. I really believe that it is best to view others work to not only learn but take good habbits away from it as well.

Again I am not asking for someone to send me code that matches what I am trying to do. I would just like to see large open source projects and how they go about best tackling the issues is all.

Here are a couple of open source autonomous vehicle navigation links:

jremington:
Here are a couple of open source autonomous vehicle navigation links:
GitHub - RTIMULib/RTIMULib-Arduino
http://ardupilot.com/

Thank you those are a good start. Autonomous vehicles provide some interesting code. Lots of math going on for these things so those links will be good starters.

How about this project, complex enough for you?
http://www.thebox.myzen.co.uk/Hardware/RFID_Sequencer.html

Then there is this one as well
http://www.thebox.myzen.co.uk/Hardware/Hexome.html

tekati:
My big question I guess at this point is will the Arduino IDE be suitable to make code small enough and fast enough to run everything on this board? It will be used as a Tank Controller to monitor things like heat, pumps, valves and more.

The IDE is only a front-end for the compiler and that does a very good job of converting the C/C++ into efficient assembler code. You would be hard pressed to write better assembler code - even if you had the time. People have spent many person-hours over many years honing the compiler to its present state. It was not just conjured up by the Arduino folks.

So the question of whether your code is small enough is down to how you write your program and what features you want to include. An Arduino is a small device with limited hardware so, of course, it is possible to dream up a project that is beyond its capabilities.

...R

Grumpy_Mike:
Then there is this one as well
http://www.thebox.myzen.co.uk/Hardware/Hexome.html

Really like this. Very nice.

That is wrong with thw answers in your other post on this topic?

Mark

That is wrong with thw answers in your other post on this topic?

Mark