Skip navigation
2015
hwhardsoft

Arduino Din rail enclosure

Posted by hwhardsoft Nov 28, 2015

Hi,

 

ArduiBox Open is a brand new DIN rail enclosure set to mount an Arduino Uno (or compatible devices) in a control cabinet. This video shows the main features:

 

 

 

Pls visit www.hwhardsoft.de for more information

In this Blog

Download the Arduino software and power up the Uno and Due. Look at debug, does it exist from the Arduino GUI?

See previous Blog…

http://www.element14.com/community/groups/arduino/blog/2015/11/23/1-aardenergy-kick-off--a-new-project

IDE Download

IDE Down load from Uno board page, version 1.6.6 (I had already installed 1.6.5, so an upgrade). 1.6.5 uninstalled first, 1.6.6 now in place.

However, under Tools>Board…Due is not listed.

Get Started with Uno

Use the IDE, Help>Getting Started.

  • Plug USB into socket on Uno
  • Power LED is on (and port  LED is blinking)
  • In Windows Device manager select Ports and find Arduino Uno (COM3) (note Windows 8.1)
  • Right click and update driver from C:\Program Files (x86)\Arduino\drivers
  • Open Blink in IDE File > Examples >01.Basics > Blink
  • Select board as Uno
  • Select Serial Port (COM3 as determined above)
  • Upload, TX, RX LEDs flash happily.
  • And LED on pin 13 is flashing, so all good.

That went well but the Due was not listed so let’s try that from the link above.

Get Started with Due

Due board needs a micro B USB cable. Order this one:

http://www.amazon.co.uk/dp/B00FAAGNLU/ref=pe_385721_37986871_TE_item

The cable has arrived and fits the board programmer port (and it fits the Native USB port). The Due powers up, Green LED is on and the yellow LED blinks.

There are some special factors to keep in mind with the Due, read the guide:

https://www.arduino.cc/en/Guide/ArduinoDue

Follow the guidance on the drivers:

(Note that is says “tested on Windows XP and, but we are using 8.1)

From Device Manager>Ports, Arduino Due Programming Port is COM4. Right Click and Update Driver Software. Browse to C:\Program Files (x86)\Arduino\drivers. Hit Next and drivers are up to date.

Also load the core software to support the Due:

From Tools>Board>Boards Manager

Install the SAM board ARM Cortex-M3

The Due can now be selected from the list of boards.

Test the set up by loading the Blink programme:

  • Open Blink in IDE File > Examples >01.Basics > Blink
  • Select board as Due
  • Select Serial Port (COM4 as determined above)
  • Upload, TX, RX LEDs flash happily.
  • And yellow LED is flashing, so all good.

Software Debug

I am curious about how to debug the software, is there a Debug Mode or JTAG port? There is nothing on the GUI as far as I can tell at the moment. A Search for Arduino Uno Debug threw up a discussion on element14:

http://www.element14.com/community/thread/17697/l/debugging-atmega328?displayFullThread=true

Looks like print on the serial port is the Arduino “debug” unless you add some other utility. In essence a Uno Sketch needs to be simple to get away with no debug tool. This also might help:

http://www.element14.com/community/groups/arduino/blog/2012/09/30/the-first-practical-arduino-debugger

On the Due there is a Debug connector marked up but is not described in the top level Arduino document. A search throws up comments about the port as JTAG but used with third party tools:

http://forum.arduino.cc/index.php?topic=134907.0

So as a challenge I’ll attempt to use Arduino GUI and see how far I get with a fairly ambitious project to do real time calculations using Due board!

Other Blogs:

1. AardEnergy – Kick Off - a new project

3. AardEnergy – Current and Voltage Transformers

 

Next Steps

After a bit more shopping I have a Current Transformer and a Voltage Transformer to evaluate. In the next blog there will be some analysis of the signals from these sensors as well as some measurements to assess performance. That should lead on to a design for the Uno and the Due interface. The plan is to use a metering chip with the Uno and to a use direct analog input to the Due.

 

These are the sensors:

AardEng Parts_002 small.jpg

And, here is the ARDUINO MEGA, REV 3 Farnell 2285197 prototype board, which appears to be compatible with the Due.

AardEng Parts_006 small.jpg

1. AardEnergy.

 

A Simple Plan

  • Measure current and voltage on single phase electrical supplies
  • Calculate electrical parameters like RMS, Real Power, Apparent Power, Power Factor, Frequency, THD, kWhr
  • Use Arduino Uno with an electrical metering chip for parameters
  • Use Arduino Due using software calculation of parameters

Kick Off

I’m new to Arduino but have used microcontrollers like PSoC4 and ARM Cortex-M3. Although my career has been more about hardware design I have written software, but would not claim to be a full time software professional.

I want to keep the voltages low on the boards to make them safe to handle, so no 240Vac mains exposure!

The current transducer needs to be an isolated type that can be clipped around an electrical feed wire. So it could be a Hall based sensor like LEM or a current transformer CT. I also want the set up to be cheap and available for other people to try out, the attraction of Arduino is the number of people learning about electronics and software. A bit of a survey turned up some CTs on Amazon which makes them readily available to all.

So the design decision at the moment is to use a CT for current measurement.

Voltage measurement also requires isolation. I’ve just spent 6 months designing an isolated amplifier for industrial applications, but it is too expensive for a low cost Arduino project and too complex. It is possible to buy plug in transformers with an AC output and I intend to use one of these as the source of a low voltage signal and isolated from the mains. It could also double up as a power supply to the finished project with some useful power up/down features for metering.

With all this in mind I bought some bits, starting with the Arduino. It was all a bit of a guess as I had no idea about the compatibility of Uno and Due parts or even whether they are the right parts for the job; so all a bit of a voyage of discovery.

Uno

The Uno uses an ATmega328P chip which is an 8 bit microcontroller. I am not expecting it to log waveform data in real time and do complex calculations. It does have an SPI port which will make it compatible with metering chips that do the calculations in real time and transmit the results to the Uno board. It has some EEPROM which is useful for kWhr retention when the power goes off.

Due

The Due uses an Atmel SAM3X8E ARM Cortex-M3 chip which is a 32bit microcontroller. I am expecting to be able to log current and voltage waveforms in real time and do some calculations without any need for a metering chip. EEPROM storage may need to be external, not yet sure if the internal memory is accessible for data.

Accessories

I’m expecting to build any additional circuits onto a prototype board, not one of the plug in type panels you see in Arduino kits.

A display will be a useful thing, rather than relying on a PC display of results.

Shopping List

With all these things in mind I sent off a shopping list to Farnell and received some parts.

  • Arduino Uno 2075382. Neat little board, clear silkscreen, ready to go. No product data came with it, just a guarantee and a sticky label telling me to visit Arduino.org.
  • Arduino Due 2250861. Another neat board, bigger than the Uno, clear silkscreen and ready to go. No product data just the same sticky label.
  • Prototype Shield 2075345. A prototype board compatible with the Uno but not the Due. Did not know whether to expect the Uno and Due to have a common footprint. Have yet to identify the prototype board for the Due.
  • TFT LCD display 2360852. Okay, well this board is not directly compatible with either the Uno or Due

So a bit of a “lesson learned”. Arduino boards are not compatible across types and not all that clear at time of purchase.

Shopping List 2

The prototype shield for the Due appears to be the PROTO BOARD, ARDUINO MEGA, REV 3 Farnell 2285197.

And the LCD display is compatible with the Arduino Esplora Boards. But there is a tutorial to help you connect to other types of board. https://www.arduino.cc/en/Guide/TFTtoBoards . Could be mounted on a prototype shield for each type of CPU.

To provide a low voltage AC measurement, a plug-in transformer should work, Farnell 2112026.

At Farnell the lowest cost current transformer that clipped onto the cable was 1797760, a 50A device at £37.61. From Amazon the SCT 013-030 is a 30A device that costs £8.75.

Do I need to buy a book? For now I’ll rely on the Arduino website…

Parts ready for set up

 

Arduino Boards

 

Next Steps

…down load the Arduino software and power up the Uno and Due.

https://www.arduino.cc/en/Main/ArduinoBoardUno

http://www.atmel.com/Images/doc8161.pdf

https://www.arduino.cc/en/Main/ArduinoBoardDue

http://www.atmel.com/Images/Atmel-11057-32-bit-Cortex-M3-Microcontroller-SAM3X-SAM3A_Datasheet.pdf

  Big question, how do I debug the software? Is there a JTAG interface for debugging with breakpoints? Am I too optimistic?

Next Blog:-


2. AardEnergy – Set Up Uno and Due

3. AardEnergy – Current and Voltage Transformers

4. AardEnergy – Metering Chips

 

Peter Cox-Smith, 23 Nov 2015

What is ?

From a server to a SBC (Single Board Computer) or the board of your last robotic project it is not rare nor strange the need to keep the system and the container box under control avoiding excessive shocking vibrations, too much heating, adding a reliable digital power on/off system or reset automatically the entire device under certain conditions, as well as the availability of constantly updated parameters like the internal device temperature, the buttons pressed by the user (or state of some external digital input or sensor), the number of hours the system is up e.g. to test the battery durability or battery level.

IMG_20151106_115542.jpg

The Circuit health control Arduino compatible is based on a previous project ( Microcontroller Health Status Controller Board based on AVR328p ) developed to control a SBC server. Then with some modifications to the original circuit based on the Atmel AVR328pAVR328p this board become general purpose, easy customizable and compatible with most of the popular Arduino boards.

 

Note: the board can be used together with any kind of device as it runs independently but the controlled device.

The board kit is available now on Drobott.com! (don't forget the special Element14 users 10% discount code: W0E49MYQ when buying)

 

Arduino compatibility features

Not only this board is based on the ATMega328p micro controller IC, the same hosted on the Arduino UNO boards, but the firmware has been developed including the Arduino bootloader. This means that the software can be opened as a normal Arduino sketch with the Arduino IDE (compatibility starts from the version 1.6.x of the IDE).

 

The Circuit health control is provided natively with a booloader version of the firmware as explained in this article; the software, released as Open Source under the Apache license can be cloned from the github repository and customized following the user needs. As the on-board IC micro controller include the Arduino bootloader the board can be programmed by any user with... another Arduino ! When programming the board firmware a USB powered Arduino UNO is sufficient to power the connected board without any extra power source.

IMG_20151106_140151.jpg

 

How does it works?

The following video shows the main features of the work on the testing bench.

 

The components

The system consists of the control board and a set of accessories processing external data, plus the connection with the controlled system if needed.

 

LCD display

IMG_20151106_091139.jpg

The 16x2 alphanumeric LCD display continuously monitor the system health status by default: temperature, fan percentage speed, up-time in hrs, min, sec. When an alarm condition occur (shock risk or overheating) the display shows the alarm condition. The display is also used to show message feedback to the user interaction.

 

Temperature sensor

IMG_20151106_091337.jpg

The temperature sensor is based on the IC LM35. The internal calculations for the read values have one decimal C precision while the display only shows integer values. By default the maximum temperature working value without overheating risk is 60C and the minimum temperature value to start the fan (10% of the max speed) is 30C. These values can be set as well, depending on the environment where the board is used and where the sensor is positioned.

 

Vibration sensor

IMG_20151106_091316.jpg

The vibration sensor sensitivity can be regulated with the trimmer on the board; the regulation should be done to trim the vibration alarm in different conditions depending on the environment where it is installed. The sensor generates a digital signal every received vibration in the sensitivity range.

By default the board firmware react to the first detected vibration generating a shock risk warning on the display. If the  vibrations continue for five seconds the warning become an alarm; then the board can automatically power off the controlled device.

 

Cooler fan

IMG_20151106_091429.jpg

The cooler fan is controlled as direct feedback by the temperature sensor. Depending on the instant detected temperature with a resolution of about 0.5C the fan speed is updated between 10% and 100% or 0% (stopped when the temperature is under the minimum of the configured range). The fine tuning of the fan response to the temperature depends on the respective position of the sensor and the fan, the size of the environment where the control board is installed and the heating of the system when it is running. The control board can support different fan sizes working at a voltage between 6 and 24V. The Fan power VCC is separated by the control board power.

 

Note: the fan speed control uses the PWM but works with cheap fan devices without the PWM control line; the shown used model is a 12V fan motor with two power cables only.

 

User programmable buttons

IMG_20151106_091359.jpg

The two user programmable buttons can be associated to any action of the controller. Typically the two buttons can be used for reset and power on/off where the action on the controlled board is managed by the controller, for example sending a long press for power-on or a press sequence to reach certain results.

 

Programmable digital output signals

IMG_20151106_091518.jpg

The board provide two digital output signals. These can be used to simulate a button-press or a button-sequence. The two signals are amplified by a couple of  2N22222N2222 acting as switch The signals can also be connected to a 5V coil relais to manage higher currents

 

Separate power lines

IMG_20151106_091458.jpg

The board is provided with two separate power lines: a 5V to power the board (can be replaced by the Arduino board while programming the micro controller) and a power line for the cooler fan.

 

Schematics and layout

The two images below shows the circuit schematics and the PCB layout.

Circuit Health Control Schematics.png Circuit Health Control Layout.png

... and the board on the test bench connected to the Arduino ISP programmer

IMG_20151106_140136.jpg

 

Firmware

The Circuit health control is provided with a pre-installed firmware including the Arduino bootloader. This makes the original sketch available to any customisation and configuration. The main source is divided in four parts.

 

1. Application definitions

This includes the parameter constants that can be changed to change the behavior of the board in the different conditions

//! Minimum PWM frequency to start fan
#define FANSPEED_MIN 60
//! Maximum PWM frequency to reach
#define FANSPEED_MAX 255
//! Minimum temperature to start fan
#define TEMP_MIN 30
//! Maximum temperature before overheating error
#define TEMP_MAX 90

//! Loop update frequency
#define UPDATE_FREQ 10
//! Fan full speed test during initialisation
#define FAN_TEST_MS 2500

//! PWM Pin conntrolling the fan speed
#define PWM_FAN 3
//! Analog pin controlling the temperature
#define ANALOG_TEMP 0
//! Reset button pin
#define RESET_BUTTON 2
//! Power on/off button pin
#define POWER_BUTTON 7
//! Vibration sensor pin
#define VIBRATION_SENSOR 0
//! Server control power simulated button pin
#define SERVER_POWER_BTN 8
//! Server control reset simulated button pin
#define SERVER_RESET_BTN 9

#define SERVER_ON  1    ///< Server powered on
#define SERVER_OFF 2    ///< Server powered off
#define SERVER_RESET 3  ///< Server restarting after reset
#define SERVER_POWER_TIME  10000   ///< msec for server going up (power On and Reset)
#define SERVER_POWEROFF_TIME 5000  ///< msec for server goind down
#define SERVER_RESET_TIME 5000    ///< msec for server goind down
#define BUTTON_PRESS_TIMEOUT 5000  ///< msec Timeout when a button remain pressed
#define POWER_ON_DELAY 5000    ///< Power on message delay before starting server
#define ALARM_TIMEOUT 5000     ///< If shock alarm is longer, the system is shutdown
#define FIRST_SHOCK_DELAY 1000    ///< ms before checking the alaram persistance
#define SENSOR_READINGS 500       ///< Number of vibration sensors reading for persistance check
#define PRESS_POWER_FIRST 1    ///< Power button has been pressed
#define PRESS_POWER_SECOND 2   ///< Power button pressed again to confirm (Only for shutdown)
#define PRESS_RESET_FIRST 3    ////< Reset button pressed
#define PRESS_RESET_SECOND 4   ///< Reset button pressed again to confirm
#define BUTTON_PRESS_NONE 0    ///< No buttons has been pressed
#define MIN_FANSPEED_PERC 10   ///< Minimum fan speed PWM percentage to start the fan motor
#define RESET_CYCLE_DURATION 500      ///< ms the simulated server reset button should remain pressed
#define POWERON_CYCLE_DURATION 500    ///< ms the simulated server power button should remain pressed to power off
#define POWEROFF_CYCLE_DURATION 5000  ///< ms the simulated server power button should remain pressed to power off





 

2. Setup and main loop

Defines the logic of the board in the various conditions

//! Main loop application
void loop(void) {
  // ==============================
  // Check the schock risk status
  // ==============================
  // Shock alarm is checked only when the server is running
  if( (digitalRead(VIBRATION_SENSOR) == HIGH) && (serverStatus != SERVER_OFF) ){
    // Shock alarm - Initialise the count
    showShock();
    // wait a few second(s) to reduce the sensor sensitivity before checking
    // for risk condition persistance. This value is calibrated experimentally
    delay(FIRST_SHOCK_DELAY);
    shockAlarmTimeout = millis();
    int numberShock; // counter of the detected vibrations
    // Exit from the alarm loop only when the alarm ends or the system shutdown process is started.
    boolean alarmSet = true;
    numberShock = 0;
    while(alarmSet) {
      // Read 100 times the sensor.
      for(int j = 0; j < SENSOR_READINGS; j++)  {
        if(digitalRead(VIBRATION_SENSOR) == HIGH)
          numberShock++;
      } // vibration counter loop
      // If alarm condition persists, update the display
      // to create a blinking effect at the end of every loop
      if(numberShock > 0)
            showShock();
      // Check for alarm timeout
      if( (millis() - shockAlarmTimeout) > ALARM_TIMEOUT)
        alarmSet = false; // just exit from the loop
    } // alarm timeout loop
    // If alarm condition persisted for too much time, the server is
    // powered off, else restore the normal conditions
    if(numberShock > 0) {
      showServerStartingStopping();
      execServerPowerOff();
      serverStatus = SERVER_OFF;
      buttonPressed = BUTTON_PRESS_NONE;
      initFanTemp();
    }
    else {
      // Restore the normal condition
      buttonPressed = BUTTON_PRESS_NONE;
      serverStatus = SERVER_ON;
      initFanTemp();
    }
  } // end vibration alarm check

  // ==============================
  // Check the state of the buttons
  // ==============================
  // Manage Reset button ------------------------------------------
  if (checkPushReleaseButton(RESET_BUTTON) == LOW) {
      showAction(RESET_BUTTON);
      // Reset button
      if( (buttonPressed == PRESS_RESET_FIRST) && (serverStatus == SERVER_RESET) ){
        buttonPressed = PRESS_RESET_SECOND;
      } // Second button accepted
    else {
      if(serverStatus == SERVER_ON) {
        buttonPressed = PRESS_RESET_FIRST;
      } // Server on, can reset
      else {
        buttonPressed = BUTTON_PRESS_NONE;
        initFanTemp();
      } // Server off, reset impossible
    } // First press
  } // Reset button pressed

  // Manage Power on/off button -----------------------------------
  else if(checkPushReleaseButton(POWER_BUTTON) == LOW) {
    showAction(POWER_BUTTON);
    if( (buttonPressed == PRESS_POWER_FIRST) && (serverStatus == SERVER_ON) ) {
        buttonPressed = PRESS_POWER_SECOND;
    } // First button already pressed with server on
    else {
      // Power on the server
        buttonPressed = PRESS_POWER_FIRST;
    }
  } // Power Button pressed

  // =========================================
  // Process the current buttons status action
  // =========================================
  switch(buttonPressed) {

   case BUTTON_PRESS_NONE:
    // No action request, check health status and go ahead
    checkHealthStatus();
    startTimeSec = millis(); // Initialise the timeout counter
   break;

   case PRESS_POWER_FIRST:
    if( (millis() - startTimeSec) > BUTTON_PRESS_TIMEOUT) {
      buttonPressed = BUTTON_PRESS_NONE;
      initFanTemp();
      } // First button timeout
    else {
      if(serverStatus == SERVER_OFF) {
        showPowerOn();
        execServerPowerOn();
        delay(POWER_ON_DELAY);
        showServerStartingStopping();
        delay(SERVER_POWER_TIME);  // Wait for server power on and start
        serverStatus = SERVER_ON;
        buttonPressed = BUTTON_PRESS_NONE;
        initFanTemp();
      }
      else {
        // Ask for confirmation to start poweroff sequence
        showPowerOff();
      }
    } // No timeout
   break;

   case PRESS_POWER_SECOND:
    showServerStartingStopping();
    execServerPowerOff();
    serverStatus = SERVER_OFF;
    buttonPressed = BUTTON_PRESS_NONE;
    initFanTemp();
   break;

   case PRESS_RESET_FIRST:
    if( (millis() - startTimeSec) > BUTTON_PRESS_TIMEOUT) {
      initFanTemp();
      serverStatus = SERVER_ON;
      buttonPressed = BUTTON_PRESS_NONE;
    } // First button timeout
    else {
      showReset();
      serverStatus = SERVER_RESET;
    }
   break;

   case PRESS_RESET_SECOND:
    // Reset sequence
    showServerStartingStopping();
    execServerReset();
    delay(SERVER_RESET_TIME);
    serverStatus = SERVER_ON;
    buttonPressed = BUTTON_PRESS_NONE;
    initFanTemp();
   break;
   }

    delay(UPDATE_FREQ);
}





 

3 & 4. Management functions and Display functions

This part of the main sketch includes all the functions and methods used to display the different status and the methods to manage the hardware, sensor reading, I/O setting etc.

 

Software repository

The last updated firmware version can be downloaded from the GitHub repository at the following address: alicemirror/CHC

arduboy.jpg

A new Arduino Gameboy called Arduboy. Nostalgia is fun, and nostalgic games are even more fun. Arduboy is a new and cheap ‘gameboy’ that allows you to play games old-school. (via Arduboy)


I can't believe I missed out on this cute little gameboy-ish system powered by Arduino, with a heaping dose of nostalgia along with it. The creator, Kevin Bates, is calling it an Arduboy and he quit his full time job over a year ago to develop this creation. He even moved to China to get the production line all set up and have his product in the making. Now, that is definitely commitment.

 

The Arduboy is the size of a credit card and has an 8 hour battery life, meaning that waiting for your friend to get out of the bathroom at Starbucks just got way more fun. The Arduboy is powered by Arduino, a black and white 1.3 inch OLED screen, and two piezo speakers. Basically, it has everything you need to game in vintage style.

 

It also had... a great price point, at $29. You can get one for $39 direct from them. The Kickstarter campaign ended with over $433,000 in funding. This is over 17x their original pledge goal.

 

arduboy games.JPG

Arduboy games from the community.

 

The Arduboy is also open source so you can code it to do whatever you’d like. Bates has also sent over 100 developer copies to ensure that there are at least 100 free and open source games available for the Arduboy by the time it gets to you. Some of the games include knock-offs of popular games like Oregon Trail, Flappy Bird, and Ardumon.

 

Bates told the peeps at Engadget that he eventually wants to sell the Arduboy for $10 and have it available for companies to brand and giveaway as conference swag. If that ever happens, I will attend way more conferences. 


If anything, I take away a little inspiration from the Arduboy. The creator took a simple design all the way, committed to the project, and won out in the end. It's time for everyone to do the same...


C

See more news at:

http://twitter.com/Cabe_Atwell

Filter Blog

By date: By tag: