Pages: [1] 2   Go Down
Author Topic: Newbie Seeking Guidence on Software and Hardware  (Read 1769 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 79
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi!

One of the techs at work turned me onto Arduino for a system redesign.  My plan was to use an atmel micro-controller, and I was nit-picking at the details of power decoupling and he said "Hey! take a look at this."  Wow, what an amazing concept!  These little boards are neat for the price, and are perfect for my one-off projects.

What I'm hoping to get feedback for is primarily how I should approach my software setup for this project.  More specifically:

* Should I fuss with interrupts?  Or should I just write one big loop that goes on until power is shut off?  I could, for instance, tie my switch changes to interrupt pins...
* Should I store data on my system layout and write simplified code that processes this data, or should I hard code it all into instruction memory?
* How should I handle memory and instruction memory faults?  I need to understand the possible failure modes and be able to address them with additional components.

The project is a high pressure test system.  The controller will sample the states of DTSP switches (on-off-on) to determine the state of valves (driven by relays) and light indicators (R/Y/G/Off Quad-state).  The controller will also need to take into account various fault conditions and respond appropriately.  On top of all that, my controller will need to be able to tell my computer what it is up to (What are the valve and fault conditions), and take input from the computer (if a particular switch for a control is in the middle position, then the computer is driving that control).

The vast number of I/O I need for this has led me to the Seeeduino Mega.  Nice little board.  I've already programmed a few example/learning programs on it just to familiarize myself with the platform (I've been programming for years, but only messed with MCUs back in my college days for a senior project).

My goal is to route all the signals via a "shield" that will adapt to the top of the Seeedunio Mega, and those signals will go through what ever "glue-logic" is needed into ribbon cable headers.  The ribbon cables will terminate on DIN Rail terminal blocks (such as Altech FBK34 and such) and from there go to my various components.

The software I'm using on the computer to communicate with the MCU will be coded in LabVIEW.  I've played around with this already, and am confident that this will work... I think smiley-razz.  I definitely need to be careful not to lose this USB connectivity functionality by having something on a PIN that interferes with this (It looks like most of the pins are multi-functional).

I've worked out a spreadsheet of all my connections against Seeedunio pins so I can start making some decisions on what I want, where.  Already I'm seeing a need to move some of my outputs around.

Here is a link to that table (Excel 2003, let me know if you want me to convert it to something else), as I think it illustrates the size and scope of my project.   :o

Edit: I guess I will post it in my follow up message because it is telling me I need to post 1 normal message or something.... I guess spam has to be fought somehow.

Thanks for your input!  I'm really excited to get going on this Arduino approach to MCU design as it compliments my job requirements very well.  It is also refreshing to see a thriving community around it  ;D.

-Nickerbocker
Logged

0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 79
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Here is the link to my spreadsheet of connections:

https://files.me.com/nickerbocker/i61f1x
Logged

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 197
Posts: 12741
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset


Clicking the link you provided...

[WinZip]
Internal error detected
WInZip will exit.  Please re-start WinZip and try again.

Quote
The project is a high pressure test system
High pressure in the "1000 psi" sense?  In the, "someone will die if this doesn't work" sense?  In the, "I'm gonna lose my job if this doesn't work" sense?

Quote
The controller will also need to take into account various fault conditions and respond appropriately
Is property or life at risk?

« Last Edit: September 22, 2010, 08:24:48 pm by bcook » Logged

0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 79
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Idk... The zip file opens fine on my end using the compression utility in Windows XP.  People still use WinZip?  Tried WinRAR out, and it unzipped just fine too.

High pressure as in >10k psig.  And I work with these systems (have for years).  They are behind concrete walls.  Personal isn't allowed w/o proper safety apparel and everything is controlled remotely.  There are also mechanical safety mechanisms in place.  There should be no such system where an electrical fault causes catastrophic failure.  But thanks for your concern.  Property may be at risk at times (depending on the test configuration)... but that the nature of the business.  No one's life is ever really at risk... high pressure =\= life threatening if proper safety mechanisms are in place and volumes are limited.

But the way you talk, are these Arduino's not very reliable?  Is it a wrong design choice to go with these due to problems with them?
« Last Edit: September 23, 2010, 09:43:04 am by Nickerbocker » Logged

0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 79
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I would like to do some kind of a checksum on instruction and data memory every so-often to ensure there are no MCU faults.
Logged

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 197
Posts: 12741
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
But the way you talk, are these Arduino's not very reliable?
I do not have the experience necessary to know if they are or are not reliable.  In addition, you have not stated what "reliable" means to you so it would be impossible for anyone to accurately answer your question.

Quote
Is it a wrong design choice to go with these due to problems with them?
Only you can make that assessment.
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 289
Posts: 25699
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
But the way you talk, are these Arduino's not very reliable?

They are reliable, but they're not designed to industrial standards - this is a hobbyist forum.
They don't have input protection, other than that provided by the built-in devices on the MCU.
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

0
Offline Offline
Edison Member
*
Karma: 0
Posts: 1103
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You generally have 6 problem zones with microcontroller systems (note that I do not talk of the chip, but of the complete assembly of PCBs in a housing).

(1) Validity of the (VLSI) chips under normal operation conditions (temperature, supply voltage, input voltage, output current), This is generally very high. So there is no need for memory consistancy checking or such for hardware reasons.
(2) Stability of supply voltage. Tricky matter if you have to reliably handle powerdrops...
(3) System design with respect to I/O. This is often a main problem zone. You have to secure against high input voltage, output shortcuts, RF interference. This can cost you $5 per pin. I say this to show you that the price of a naked Arduino system is not an relevant asset item. However there are also low cost solutions. My recommendations are 74HC4049 for inputs and ULN2308 for outputs. But this is low cost and might not suffice....
(4) Quality of PCBs, wiring, and mechanical build, especially wrt to ground connections, temperature, moisture, and EMC...
(5) Connectors
(6) Correctness of Software. My guess is that 90% of your trouble will be here :-)
« Last Edit: September 23, 2010, 04:37:29 pm by mpeuser » Logged

0
Offline Offline
Edison Member
*
Karma: 0
Posts: 1103
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
* Should I fuss with interrupts?  Or should I just write one big loop that goes on until power is shut off?  I could, for instance, tie my switch changes to interrupt pins...
In your case with MANY and systematic I/O operations a loop will allow you a much better code overview and also precise timing. From your description I see no need for special interrupts at the moment, but this can be added later. Not thst the serial transmission to the PC is blocking; this has to be carefully examined by you.

Quote
* Should I store data on my system layout and write simplified code that processes this data, or should I hard code it all into instruction memory?
I think your application looks like "table driven".

Quote
* How should I handle memory and instruction memory faults?  I need to understand the possible failure modes and be able to address them with additional components.
You have no protection against software issues. But you could use the watchdog (or even an external watchdog) to restart your system when lost.... An initial "sanity check" (or "BITE") would be nice, but needs additional external hardware...
« Last Edit: September 23, 2010, 04:21:25 pm by mpeuser » Logged

0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 79
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks for all of the helpful responses.  I see that Arduino is for hobbiest but it is an attractive alternative to the expensive FPGA industry.  A lot of shops, like mine, do one-off jobs.  We can't design things in such a way that we plan to recoup cost by making many-many units.

I have experience with writing assembly for PIC microcontrollers (back in college days).  A lot of our system control has been done using multifunctional DAQ boards and Windows based machines.  Windows reliability...well, its crap.  Thats why we protect ourselves by mechanical means (I don't think any level of reliability would change that, tbh).  Windows faults happen, and the response is to shut off power which switches everything into a safe state.

So..when it comes to reliability, would an Arduino board offer more or less reliability than a Windows machine if properly programmed and interfaced with external hardware?

deSilva: Your info is very helpful for me!  Thanks for the feedback.  Once I nail down my pin assignments, I was considering using the on-chip EEProm to save my various assignments.  I won't need to change these very often so the 100,000 write/erase limitation does not concern me.  The main program will mostly be reading from the EEProm in a loop.

This is all coming together in my head.  I have a feeling I'm going to be making a prototype before I make a production unit.  ;D
« Last Edit: September 23, 2010, 04:45:33 pm by Nickerbocker » Logged

0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 79
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

As far as external watchdogs go, whats a good example?

My first thought is to have my program loops generate some square wave on a pin.  Filter that output with a capacitor and diode feed it into an op-amp configured as a comparator.  So long as the program is still chugging away the square wave will be produced.  If there is some fault that stops the program counter from moving forward the squarewave stops and I can have it indicate something on a panel or kick off system power.  Just a thought...

I like the approach of using the EEProm to store my "system configuration"... maybe I could do a checksum on this as another fault detection.
« Last Edit: September 23, 2010, 04:54:15 pm by Nickerbocker » Logged

0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 79
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Not thst the serial transmission to the PC is blocking; this has to be carefully examined by you.

Thanks!  I've highlighted pins 0 and 1 and will make sure no connections exist there.  I'm also going to leave 21 (SCL) and 20 (SDA) free just in case I need some I2C communication later.  My boss may come around asking me to double the number of components  :o
Logged

0
Offline Offline
Edison Member
*
Karma: 0
Posts: 1103
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Blocking.
This is a software issue. The print-library will wait until all characters have been sent. This is not acceptable for a tight main loop! You have to find a work-around (not really difficult)

Watchdog.
I should recommend the internal watchdog - see Arduino playground example. External solutions can comprise anything from a second processor, downto a retriggerable one-shot, in the easiest case a cap to be pulse charged, similar to your own idea.

EEPROM
Tables in EEPROM make sense if you have to put your code under strict revision control, and you have a tool to generate an EEPROM table. I think this is not worth the trouble. You can include all configuration tables in the FLASH area (C-tag PROGMEM)... All right, apart from the system has to be dynamically re-configured
« Last Edit: September 23, 2010, 05:43:45 pm by mpeuser » Logged

0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 79
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks again for the reply, deSilva.  When you say c-tag PROGMEM, are you saying I should just create some arrays in my initial setup function, and in my program loop, loop through those arrays?  I did a search of that term "c-tag PROGMEM" and Google brought me back to this post (dang they're fast).

Hehe, I'd already started laying out my 512 bytes of EEProm memory in my spreadsheet.  I guess what I was planning to do was write up a function on my Ardunio that allowed programming to the EEProm (using the library functions), and have this accessible via a serial command, then use some windows software I wrote to write the table up.

I think it is desirable to have the fault conditions (i.e., Fault0 pin goes high, what are the Relay0-15 outputs when this happen) to be configurable.  System changes happen often enough that change how we want the faults to be handled....reprogramming the MCU doesn't seem like a desirable approach to me.

What Relay output responds to What Switch input and turns on What Light output won't change hardly at all.  And if it does change, I would be involved and be OK with reprogramming the MCU.
« Last Edit: September 23, 2010, 05:54:53 pm by Nickerbocker » Logged

0
Offline Offline
Edison Member
*
Karma: 0
Posts: 1103
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

http://www.arduino.cc/en/Reference/PROGMEM

What you do is fine, but also error prone... It is the missing "tool" I was referring to :-)

Edit:
As you have a lot of RAM memory in the MEGA it might even suffice to keep everything in the RAM. This will simplify programming considerably.
The compiler generates initialization code to copy all presets in the RAM...

Edit2:
I just read your paragraph about "involvement". I see the danger that the configuration might become unmaintainable by permanent and uncontrolled changes
« Last Edit: September 24, 2010, 01:15:28 am by mpeuser » Logged

Pages: [1] 2   Go Up
Jump to: