Monday, December 15, 2014

Using Arduino as an IR remote and some other ideas


This post is about a simple project that was the basis of anther project posted on my blog. In this project, we are going to show how to use Arduino as a remote control for a TV. The requirement for the project was: a TV is connected to a security camera, camera is always ON, and we want to turn the TV ON/OFF from a distance/angle that the TV infrared (IR) remote does not support, please see Figure-1 below.

Figure-1 TV, Security camera and the Arduino mounted on the lower left side of the TV



As you know, the IR remote that comes with the TV works at a line of sight distance: this means you have to be facing the TV to be able to use the remote. The TV you see in Figure-1 was placed in the second floor and we want to turn it ON using a device placed at the first floor. Usually, the best thing to turn power ON/OFF is to use a relay, well that is true but note that nowadays TV needs to be turned ON using a remote after turning the main power ON. Nevertheless, the relay had to be controller from anther location, the first floor, this made things a little bit complicated!!

Best engineering practice is to divide the problem into parts, called divide and conquer approach. First, the simple part: using a relay will only help to turn on the power to the TV; but, if we connect the TV and an Arduino to the relay then relay will power the TV and in the same time power the Arduino. Bingo, think of the idea of using the Arduino as a remote: connect an Infrared (IR) LED to it and let it send the ON signal to TV after main power was turned on using the relay. What about the OFF signal? No need for it since the relay will turn the TV OFF anyway. Seems simple project!! It is simple but the relay was placed next to the TV, at the second floor, and controlling the relay was done from the first floor. Hence, the relay had to be controlled via Radio Frequency (RF)

Fortunately, a relay that can be controlled via Radio Frequency (RF) was available at hand. The relay comes with anther unit, a push button connected to a RF unit; push button used to turn the relay ON/OFF. Neither the details of the relay unit nor the details of the RF unit are available at this time; somebody else bought it, many thanks to him.    

Let us talk about the software side then we can talk about physical connection. To use the Arduino as an IR remote you need IR LED and you need to know the protocol and codes your TV use to communicate with its actual IR remote; M. McCracken explains this in details in his post and provides useful links about IR protocols and codes each TV use (you may need to be logged as registered user to hifi-remote.com). One great thing about Arduino, you can find library for anything you need; some people already did a lot of work using Arduino and made their software available to public. One name to mention here is Ken Shirriff’s work to provide an open source multi-protocol IR library for the Arduino; currently, his library is included with Ardunio and Energia distributions.

You can easily figure out the rest of steps regarding using Ardunio as an IR remote: either use the links on McCracken post to lookup the protocol your device uses and the associated ON code for your device or you us an IR detector to decipher the protocol and the codes your IR remote sends based on the Ken Shirriff’s  library. One thing to note when you are programming your Arduino to mimic a remote sending ON signal, it is timing; keep reading the hardware part to know more….

Hardware setup is simple; see Figure-2 and Figure-3 below. The multi-outlet has the relay plugged to the top receptacle and the lower receptacle has the camera AC-DC convertor plugged to it. The relay its self is powering both the TV and the Arduino AC-DC convertor using the white extension cord. Next, let us talk about the Arduino hardware. This project used ArduinoOSEPP UNO hardware; I have to admit that during the testing period, more than a month, the board never stopped responding or malfunction due to repeated restarts. On Figure-3, you can see that the IR LED is connected to a PCB breadboard and an additional resistor is used to limit the current going to IR LED; on the UNO board pin 11 and the ground pin are used to connect the IR LED. Note that the whole setup was mounted to the wall next to the TV such that IR LED is positioned as close as possible to the IR detector found in the TV. A simple AC-DC converter provides the input voltage for OSEPP UNO, 6-12 volts allowed, in this project an AC-DC 12 volts convertor was used with no issues.  One final note, when you program the Arduino, you will need to add some delay just before sending the ON signal using Pulse Width Modulation, this will the allow some time for the TV to initialize and actually turn the IR detector on. Also, it is better to add the code to send ON signal in the setup part of the Arduino code.

Figure-2 Wiring setup showing a picture of the relay on the bottom
 
Figure-3 OSEPP Arduino mounted next to the TV; note IR LED is in front of the IR detector inside TV


Sunday, December 7, 2014

Project: Motion Sensing over wireless link using MSP430 and Anaren Booster Pack

In a previous post, problem of finding suitable programming environment for the Anaren Booster Pack has been discussed; we talked about how easy it was to program MSP430 using the Energia environment. In the newer versions of Energia 0101E0013 (09/05/2014), Anaren has included a library with some cool functions and couple of code examples for sensor-hub communication, control example, and simple wireless communication test example. Stay tuned to read a nice post about a simple modification to Anaren code to include acknowledgment mechanism. But for this post will cover a cool project that I was asked to do.

Requirements were simple: we have a TV connected to a security camera (camera always on). Turn TV ON whenever motion happens in a certain area. To safe power, TV had to be turned OFF when no motion is detected for a specified period.  


Remember in a previous post you have seen how to program a pair of TI MSP430 Microcontroller Units (MCU) to communicate motion detection event coming from Passive Infra Red (PIR) sensor. Well, this is just what we are going to do in this cool project. One end, where motion is to be detected, will have a PIR sensor connected to MSP430 MCU plus Anaren Booster Pack RF module in order to communicate motion detection event to the other end. On the TV/Security camera end we have to turn the TV ON when receiving a signal on the RF module. While first thing comes into your mind is a RELAY to turn TV ON, remember that now days all TV’s need to be turned on using an IR remote even if the power source is on!! To satisfy your curiosity, yes we will have a post about using a relay to turn TV. In that project, my contribution was only the part of turning TV on using Infra Red (IR) signal coming from IR LED connected to the MCU after the relay turns power source on; stay tuned to see how to get MCU acting like a remote!! This post will only deal with the end composed of MSP430 LaunchPad, PIR sensor and the Anaren Booster Pack. 





Figure 1 TI MSP430 LuanchPad, Anaren Booster Pack inside the enclosure

 First thing is to decide program structure, next we can talk about the choosing enclosure, mounting, and power supply. As mentioned above, code examples published by Anaren included a sensor-hub example code; this is exactly what we need. The sensor will send data and hub will receive data; we can choose to have the hub acknowledging sensor’s packets but this project did not go this direction, we will talk more about using an acknowledgment in the end of this post. Since one requirement is to count no motion period, we have to use timers. Since MSP430 is busy with counting (timer), we can not afford to have the MCU waiting on a positive edge from PIR (when it detects motion); interrupts will be the best choice to alarm for a positive edge. Next, we get to choose the pin on MCU to connect to PIR output. Note that some pins do not have interrupt enabled, and some pins are used by the Anaren Booster Pack. This leaves us with very limited choice, either pin 1_3 or pin 2_3. In our code we choose pin 1.3 which is defined as PUSH2 in Energia, it happens to be connected to a push button on TI LaunchPad. Next, lets us choose the timer; note that we need to measure periods in order of minutes when counting no motion period. This means the timer should drive its clock from a low frequency oscillator; MSP430 has many choices for oscillator. MSP430 runs its system clock of 1.1MHz oscillator, but the best thing with MSP430 is you can run multiple oscillators same time.  You can have a 1.1Mhz oscillator as the source of the system clock and anther low frequency oscillator for peripherals.For a low frequency , the VLO oscillator is one choice, it runs somewhere around 12KHz, and the second choice would be to attach an external crystal, the one supplied with TI Launchpad provide 32KHz clock. VLO was the choice for this setup, and this allows a timer as long as 40seconds.  If you allow the timer to overflow certain number of times you can get the time period you like; allowing the timer to overflow 15 times will allow periods of10 minutes. Well, this is it about the program structure. Below is code:

#include <SPI.h>
#include <AIR430BoostFCC.h>
// -----------------------------------------------------------------------------
/**
 *  Defines, enumerations, and structure definitions
 */
#define ADDRESS_LOCAL    0x02
#define ADDRESS_REMOTE   0x01
#define PIR_Settling_Time 20000 //Allow PIR learn its environment up to 40sec (datasheet)
#define CC110L_Settling_Time 5000//Startup time between MSP430 and CC110L
 /**
 *  sPacket - packet format.
 */
struct sPacket
{
  uint8_t from;           // Local node address that message originated from
  uint8_t message[1];    // Local node message
};

// -----------------------------------------------------------------------------
/**
 *  Global data
 */
 struct sPacket txPacket;
volatile boolean Lockhigh=true;
volatile unsigned char counter = 0;
 // -----------------------------------------------------------------------------
// Main example

void setup()
{
     //Allow setup time for PIR and CC110L
     if (PIR_Settling_Time>CC110L_Settling_Time){
      delay(PIR_Settling_Time);}
       else{delay(CC110L_Settling_Time);}
  /**
   * 
   *  Note: Set radio first to ensure that GDO2 line isn't being driven by the
   *  MCU as it is an output from the radio.
   */
    Radio.begin(ADDRESS_LOCAL, CHANNEL_1, POWER_MAX);

  txPacket.from = ADDRESS_LOCAL;
  memset(txPacket.message, 0, sizeof(txPacket.message));

   WDTCTL = WDTPW + WDTHOLD;      // stop WDT
  
   pinMode(PUSH2,INPUT);//P1.3 is PIR input
   attachInterrupt (PUSH2, Port_1, CHANGE);//activate interrupt on pin P1_3
   P1DIR = BIT0; // set P1.0 as output (RED LED on LaunchPad)
   P1OUT =~BIT0;// Turn OFF RED LED
     
   BCSCTL1 = CALBC1_1MHZ;    // Set DCO to calibrated 1 MHz.
   DCOCTL = CALDCO_1MHZ;
   BCSCTL3 =LFXT1S_2;   //Set VLO
   TACCR0 = 60000 - 1;    // A period of 60,000 cycles (~40sec@VLO)
   TACCTL0 = CCIE;        // Enable interrupts for CCR0.
   TACTL = TASSEL_1 + ID_3 + MC_1 + TACLR;  // ACKL, div 8, up mode,clear timer
 
}

void loop()
{
 
}

//// Timer A interrupt service routine
#pragma vector=TIMER0_A0_VECTOR
__interrupt void Timer_A()
{
       if(counter == 10 & !Lockhigh ) {// this is when the PIR indicate no motion for 10min
        counter = 0;
        txPacket.message[1] = 'O';
        Radio.transmit(ADDRESS_REMOTE, (unsigned char*)&txPacket, sizeof(txPacket));
        P1OUT =~BIT0; // RED LED OFF
        Lockhigh=true;
       }
        else {// this is when PIR indicate motion or while no motion w/time <Total Wait Time
         counter++;
            
      }
}
  
// Port 1 interrupt service routine
//__interrupt void Port_1()
void Port_1(void)
{
 
   if (digitalRead(P1_3) && Lockhigh){
   P1OUT = BIT0; // Trun on RED LED in case of motion being detected
   txPacket.message[1] = 'A';//
   Radio.transmit(ADDRESS_REMOTE, (unsigned char*)&txPacket, sizeof(txPacket));
   Lockhigh=!Lockhigh;//Toggel Lock (indicate no motion period /end of no motion period)
   }
    else {counter=0;}//any other signal from PIR rests timer
 }


Next, we will talk about the final product including hardware, enclosure, mounting and power source. Note that Anaren Booster Pack can be a stand alone; you can mount the TI MSP430G2553 onto the board and connect led, push button and power supply with some capacitors, please see Figure 2 below from Anaren manual. In this project, soldering surface mount components was not possible; the final product used LuanchPad to hold the MCU and Anaren Booster Pack as shown in figure 1 above. Since PIR sensor has to sticking outside the mount, you need to choose a mount with flat surface on one side. Drill through the flat surface a hole such you can mount the PIR sensor with its lens outside as shown in figure 3. Note in this figure; the power source is sticking to the side of the enclosure; a simple phone charger with USB output has been used.
 
Figure 2 Picture courtesy of Anaren
Figure 3 Enclosure with PIR sensor sticking out of it


Trouble shooting:
Possible problems that you may face are as follow
1-      Failed communication between the unit holding the sensor and unit responsible for turning TV ON. If this happens you will note indicator led, shown in figure one above, tuned ON while the TV is OFF or visa versa. Just rest the unit by unplugging the power from the unit with PIR and make sure the TV is turn off .Then plug power to the MCU connected to PIR, make sure to allow some period of no motion while the PIR learns the environment.
2-       Wires are loose; this may happen and it will cause the unit to not function correctly. Refer to figure 1 for correct connection and secure the wire to pins.
3-      Infra Red LED on the unit responsible for turning TV ON may get out of focus with the Infra Red detector on the TV. Just make sure the Infra Red LED on the MCU is in front of the Infra Red detector on the TV.
4-      If MCU goes bad then they can be replaced and programmed via the LaunchPad using the code provided.


Please stay tuned to read a nice post about a simple modification to Anaren sample code to include acknowledgment mechanism.


Monday, September 8, 2014

Programming Anaren Booster Pack: thoughts and a demo


     In a previous post, establishing Radio Frequency (RF) communication between Anaren Booster Pack modules diverged to focus more on Passive Infra Red (PIR) motion sensor and how to program MSP430 Launch Pad to display motion detection status. Instead, this post will focus more on the programming task, hopefully.
       To recap, objective was to establish RF communication with some payload (a frame of data) to indicate the detection output status of a motion sensor. Also, there was supply power conflict (+5V versus +3V) between Texas Instrument micro controller and the sensor. While you can read more on interfacing motion sensor to the micro controller in here, we will talk about programming the communication modules in this post and save talk about power supply for a following post.
     Anaren Booter Pack has two boards with Anaren RF chips pre-installed, plus two microcontrollers pro-flashed with Anaren software stack. “It is all about the protocol stack” according to Anaren; it is open source and based on Texas Instruments Simplicity protocol stack. While their documentation is kind of detailed for almost every important function in the stack, the length of the code is terrible to say the least. 
     After spending a week on understanding where/what function to modify in Anaren protocol stack, I was confessed that there is some price to pay for their protocol stack and the graphical user interface that they advertised.
Figure 1 Anaren GUI, note the windows showing RSSi and Temperature
        
As you can see above, many options for the RF chip can be controlled from GUI; almost all the parameters including: transmit power ( tx power), transmit frequency, channel, and FCC/ETSI compliance. Furthermore, you can see actual serial data communicated between the micro controller and the RF chip, done through SPI. Off course, the GUI has two windows to display the received signal strength on each chip and the temperature of each chip, yes TI has built in functions to measure the temperature, battery strength,…etc. Actually you will learn in the end of this post that TI does a very good job of providing support to their chips, unlink Anaren.Now, do not get me wrong!! I have to be thankful for humble price of their board, nicely labeling it, effort made to document functions in their stack and providing two versions of their protocol stack: one for Code Composer Studio and one for IAR workbench for TI MSP430 environment. 
Figure 2 Anaren Protocol Stack (IAR Embedded Workbench for MSP430 Environment)

     Lines and lines of code is what you get when you look into their protocol stack. As you can see above, main components include FCC/ETSI setting, application layer, protocol layer and the framework layer. The later is what we need to modify in most cases to make advantage of Anaren protocol stack. The application layer code, as name implies, is made of the set of instruction to allow successful communication between the nodes and the hub; the main topology is Star topology. In addition to data exchange (data/configuration data), this layer implements a full communication protocol: adding/removing a node from the network (assigning node ID), network validation, setting cycle time and radio sleep/wake process. The application layer intended to facilitate communication between the RF module and the Launch Pad through SPI protocol (to change settings, to receive sensor data and to listen to incoming packets received on the RF module). As we just mentioned, to make any advantage of the protocol stack you must manipulate the framework layer to make it interface your hardware used, like sensors, batteries, display, …etc.  
      Yes, you are right, if you do not like it why use it, probably that is what you are thinking. Let me explain the problems you come to meet once you try to understand/used Anaren protocol stack:


  1.      IAR workbench for MSP430 environment has a limitation of 2k byte of code; when you try to compile and load a large program like Anaren protocol stack you will get a message “code size exceeds limit for this version”
  2.  Code Composer version of the protocol stack I have not tried but you can figure from feedback that it is not easy to use it
  3.  Protocol Stack has too many layers; it is well organized for someone who wrote it. But if you want to tweak the code to achieve certain programming task it is a nightmare to go through whole stack.
     One thing tempts you to think of alternatives to Anaren code is Texas Instruments resources, starting with code snippet for many modules in their micro controller to Simplicity protocol stack written by Texas Instruments. In short, the learning curve for Anaren code is equal to going through Texas Instruments code available on line and starting to tweak them to you own desire. Remember Texas Instruments warning about side effects when combining their code snippet and not making your own program.
      On lines of what we mentioned above, you can find here code to run Anaren RF modules based on the code provided by Texas Instruments for allowing communication between chip CC2520/CC110L and a TI board, like Launch Pad or EZ430 board.  An interrupt coming on the SPI pin (pin 1.6) will indicate the RF chip received something, and when you want to send something you just put it on the SPI pin and let the RF chip send it. Basically, you will use the RF chip as queue: allow it to transmit anything that it gets on the SPI port and allow it to write to SPI port anything it receives. The author of this code added a mechanism to check for successful transmission of a packet, an acknowledgment sent from the receiver on the other side. Obviously, this approach does not work well when you have a sequence of data to transmit. According to comments from people using this code, it can be used with more than one transmitter/receiver talking to the hub node, I can not refute or confirm.  I changed the main program in the code above to make it suit my purpose; turn ON RED LED on one Launch Pad once motion is detected on the other Launch Pad. 


      Below you will find a video showing how to use code above, after some modification, to transmit the status of PIR sensor to anther Anaren RF Module. In the video you will note a booster circuit that we will talk about in a following post, please stay tuned.




Sunday, August 24, 2014

Infrared, wireless and MSP430



     Couple of years ago, Anaren marketed a radio frequency chip with an integrated antenna working at 900Mhz and based on Code Division Multiple Access Technology (CDMA) technology. Their product was based on Texas Instruments (TI) cc1110 chip and thus TI supported Anaren to market the booster pack board. In addition to anaren RF chip, the booster pack included a board having a prototyping area and a space to place a TI msp430 microcontroller. Off course, Anaren’s booster pack would best work with TI msp430 Launch Pad, see pictures below.
Figure 1 from right to left Anaren booster pack, TI Luanch Pad, and PIR motion detector sensor


     Now, Anaren have their Zigbee chip, Bluetooth chip and finally the celebrated Bluetooth SMART chip. Since their first RF chip (CDMA, 900MHz) was soled at a humble price, and because taking this course helped me to know how to program msp430 ( had to buy and use a TI msp430 lunch pad to do assignments!), I have decided buy one of Anaren booster pack and play around with it. The booster pack has two boards with Anaren RF chips, two microcontrollers pro-flashed with Anaren software stack. Since the later is the most important part in Anaren product, this post will mainly talk about programming the msp430 micro controller to do a certain task involving RF communication. First I had to establish communication between the boards without adding any payload from an external source, this was the easy part. See this link and picture below.





     While experimenting with the booster pack, I needed payload to transmit over the radio frequency link. There were many options including Boolean one/zero, digital data from a sensor, analog data converted by microcontroller to digital data stream. The choices are governed by the fact that booster pack is best used with msp430 launch kit. My choice was a simple one/zero coming from a passive infrared sensor (PIR sensor). You can buy PIR sensor from Radio shack or you can order it from Parallex website. The sensor is made of a basic Pyroelectric sensor and a Fresnel lens covering the sensor; the later is made of a material that pass infrared spectrum between 8-14µm only. Pyroelectric sensor is divided into two half; each half will detect the infrared level on its side as shown below. When both sides reports same levels of infrared they will cancel each other out and no motion is reported. Now parallax claims a field of view (FOV)of 90 degrees; for a explanations of FOV you can see this link (one of my favorite blogs).


Figure 2 Radiated Spectrum with Infrared light wave length marked
 
Picture courtesy of http://electronicsgurukulam.blogspot.com
     

     The programming task of any application involving the booster pack is to allow the micro controller to send and receive data over the radio frequency link and in the same time process data coming from an external source. The normal solution to this problem was to use interrupts.
     Since I had some cool project in mind, the following requirements were already set as the goal of my program:
Upon detecting motion, turn on a led,
As long as motion continues, keep led on,
If motion stops, do not turn led off until a certain time period has elapsed with no motion.

Wednesday, August 20, 2014

Ultrasonic Flaw Detector

     Ultrasound is an important part of Non Destructive Testing techniques; nevertheless theoretical aspect of the ultrasound is still more stressed out when talking about this inspection method. Basic constitutive laws can interrupt the theory behind flaw detector but we will keep this to anther post. This post is more about the practical aspect of flaw detection, one flavor of ultrasound inspection.

      Not the same as flow detection in fluids, flaw detection is concerned with ultrasonic testing of composite materials to find internal discontinuities. This application of the theory of propagation of sound waves through materials has reach long way now and phased array flaw detectors can show sonar like images, like the one we see at doctor clinic. This post is about the standard flaw detector, using a single or a dual element prop to send an ultrasonic waves into materials to detect cracks and irregularities; this is different from thickness detector that reveals only a digit indicating the thickness of the material being inspected.

     Basic Flaw detections devices usually have a screen that display two axis figure, one axis show the distance and the other axis show the amplitude of the reflected signal (measured in dB), please see image below
Figure 1 Ultrasonic Flaw Detector device with echo signal showing on the screen


     Here it is in simple non mathematical terms: When sound wave travels through a medium, at a constant speed, it will disperse in different directions. When hitting an edge of a medium, where the reflection coefficient differs, it will suffer reflection and deflection; the earlier is what we are looking for at our flaw detector screen. Called an echo, this reflection will indicate the nature of the irregularity seen by sound wave as it travels down the medium.

     Now let us talk about how to use the flaw detector, including choosing a prop and analyzing what you see on the screen.

     An angled beam prop, as the name implies, will force the sound wave to travel through the material in angle; thus it is more appropriate to inspect internal discontinuities at some part of a material where we do not have access to surface.

     Straight beam prop is the simplest way to perform an inspection as opposed to using an angled beam prop. Straight beam prop will force the sound wave to travel into the material in straight direction; the sound wave will reflect off any discontinuity it meets on the way. What you see on the screen on the flaw detector is the reflected signal; ideally, you will notice an echo (a peak on the detector screen) at a position (distance) corresponding to the distance of the discontinuity from the surface (where you have placed your prop). In real inspection scenario, you will see a noise floor and you want to look for the first echo reflected back in a series of echo as shown in the picture for the flaw detector screen above. In this picture, you will note the word “GATE” highlighted: it refers to a marker on flaw detector screen that you can move to be placed on the echo signal we just mentioned. Once placed at a position on the screen, marker will display the distance and signal strength received at that position.

Figure 2 Ultrasonic transducer placed on surface of a material with imagery lines showing sound reflecting of a discontinuity 










     Things you need to consider: have you calibrated the flaw detector to account for the propagation delay found in the cable and inside the prop? . You can find some more thoughts on the calibration part in this document. Generally, three methods exist for calibration: depending on the availability of a test block, one can choose to use either Distance, Gain and size curves (DGS), or use a test block with or without Amplitude Distance Correction curve (ADC). Both approaches suffer uncertainties due to ignoring the defect geometry, orientation and surface quality but material attenuation is accounted for in the reference block method.

      While reference block methods are simpler, they can be divided into two categories, one requires the inspector to carry reference blocks to compare defect echo to the reference block echo and the other technique requires establishing ADC curve before inspection. All approaches produce a reading indicating how many dB the defect is larger from the minimum allowable defect size, but in case DGS the Equivalent Reflector Size (ERS) can be obtained form DGS curve directly with some tolerance due to sound attenuation.

     Please stay tuned to know more about constitutive laws the flaw detector use to calculate the distance to a discontinuity in the inspected material; the same laws are used in the ultrasonic range detector to create simple radar!. 

Monday, May 12, 2014

Atmospheric pressure using Arduino



Part of quarterly vibration inspections on mine fans for a client, they requested parametric pressure included in the vibration analysis report. Due to the fact that mine fans usually are spread within a good driving distance to any mine office, where you can find a barometer, I had to come up with a way to measure the pressure on each site while inspecting. One solution was to use phone application to provide barometric pressure reading. Unfortunately, not all sites we inspect are within phone coverage!

Since an Arduino microcontroller was available around me for a while now; why not use a pressure sensor and Arduino microcontroller to capture barometric pressure readings! As it turns out, this is not a very difficult thing to do. I ordered this sensor from here

Bosch BMP180 high-precision, low-power digital barometer



You can find it on adafruit or sparkfun website. Furthermore, these sellers usually provide libraries required to use their products and even provide example codes. Off course, you will need a display screen to display the pressure reading, a cheap black letter green backlight LCD should do the job. I have used this arduino shield it also includes push buttons which will proof valuable as you will find out in the end of the blog.


Making this project work was one thing and testing it was another thing. Since pressure is a measure of the force per unit area exerted by the weight of air on a surface, you will get less atmospheric mass as the elevation increases. This means best way to test my new gadget was to use it at different elevations. Well, West Virginia Mountains provide the perfect altitude change; I made a trip to Black Water Falls in West Virginian. My trip started at my current residence at an altitude of 900ft and ended at Black Water Falls at an altitude of 3600ft above sea level! Now, to test my barometer it should be compared to a correct reference reading. The phone application we talked about earlier did serve this purpose but phone application provides altitude compensated atmospheric pressure values. This meant my barometer had to provide an altitude compensated values also. Altitude value needs to be available while you are programming the microcontroller or user needs to enter the altitude as a variable while the program is running (online). This is where the buttons on the LCD shield could help; the buttons can be used to change the altitude value without the need to change them in the program. No need to add a keypad to the design; no need to add more cost and more size (Sorry, too much work). 


Instead of using buttons on the shield, a work around was to program the microcontroller with an average altitude between 900ft and 3600ft and I have chosen 1700ft. During the trip the pressure reading on the phone and on my LCD screen did come close but during the trip my phone application was giving message indicating that pressure reading may not be accurate due to the fact that I had no pressure sensor on my phone, What!!! You mean you made me drive three hours trip to tell me I need a pressure sensor. I am just kidding, we went to see the beautiful nature in West Virginia; see picture below
 



On the way back I passed through Okland city, Maryland. While enjoying the scene on a nearby lake, I decided to try my gadget one last time. Reprogrammed the microcontroller with the correct altitude and pulled up accu Weather webpage on my phone, now this has to be correct, turned on my microcontroller. See picture below.






Now, came the moment of truth. A client called asking for urgent vibration inspection on the fan location near the office. I went to collect vibration data on the fan and off course had to collect pressure reading, see picture below.




This is a link for the atmospheric pressure and temperature near this area on the day this picture was taken
 

Sunday, May 11, 2014

VB Online Communication Troubleshooting



Our company had to commission a project for an underground mine including mounting a VB Online unit (from GE_Commtest) and setting up a wireless link to connect VB online unit to the mine wide monitoring system.  Hence, we used a wireless access point (a router in our case). Reason that VB online unit had to be wireless is that it was installed on a tripper car: part of a belt system that is mobile (moves on rails) and include two pulleys and VB online unit provide temperature and vibration readings with an update interval each 10 minutes.  With some recent difficulties experienced on Wi-Fi start-ups, I put together a brief write-up to help with steps required to solve a specific problem we faced:
After getting the wireless link up and running between access point and the VB Online, the VB Online did not respond to Ascent; VB Online does not display in the right panel of the window of “Online device Setup wizard” page. Furthermore, when entering the VB Online IP address and port number in the remote IP address field on the same page, a pop-up message shows indicate that ‘”a firewall problem”  or “TCP/IP problem exists” that prevent from communicating to the VB Online unit or that “Non response from VB Online unit”.
Steps below assume that all IP address and Network SSID information (including WPA key and other security setting) are configured correctly in the VB Online unit and VB Online unit can be access using a serial cable, and/or the Ethernet/Wifi interface on VB Online unit can be configured via telnet session using an Ethernet cable or a wireless link.
First of all, try to connect to the VB Online unit using a non-network connection- E.g. using a laptop with (COM) port and RS232 cable as shown in Figure 1 below.

Figure 1 Connect to VB Online unit#21944 using Serial Cable on COM port# 23

Once connected to VB online unit, the unit number and serial port number used to connect to the unit should be highlighted on the Online device setup wizard. Click on “Edit” button and the “VB Device Properties” page should come up. Under “Tasks” tab, look for “Reset Device” section and click the “Reset” button. Wait for a minute and note the led blink on the VB unit then a pop-up message shows indicating that unit has been reset, please see Figure 2 below.


Figure 2 VB Unit successful rest result


Next, we need to rest the Ethernet interface. This is very important to be done after a successful rest of the VB module; resetting only the VB module or only the Ethernet interface will not produce required results.  Under same “VB Device Properties” page, look for “Rest Ethernet Defaults” and click on “Defaults” button. A successful rest operation of the Ethernet interface is shown in Figure 3 below.


Figure 3 A successful Ethernet interface reset result


Once this is accomplished, then the VB module needs to be change from Serial port to Network connection through “change button” found at the setup tab under the “Change VbOnline: Wifi/Ethernet (Cabled Ethernet)” section. Make sure to connect the cross cable provided with the VB Online unit to Ethernet port on your laptop and to the VB unit before changing communication method. Press the “Change” button and a pop-up window “Change vbOnline: Wifi/Ethernet” dialogue shows. Select the “Cabled Ethernet” radio button and press “Ok” button; wait for the change to take effect as shown in Figure 4.



Figure 4 Change vbOnline Wifi/Ethernet window with Cabled Ethernet radio button selected

Once this action on the change of the module communication method is confirmed with a pop-up message, the vbOnline is properly configured for Ethernet communication to the outside world.
Now, we try to change the way Ascent software communicate with the vbOnline unit. Under Setup tab, look for “Change Ascent-> vbOnline address” section and select the Ethernet radio button. Enter IP address of vbOnline device in the IP address field. If you know the port number the vbOnline is using, enter it in the Port field as shown in Figure 5 below.


Figure 5 Enter IP address and port number in the Change Ascent-> vbOnline address section

 Once this action on the change of the way Ascent software communicate with the vbOnline device you show see this reflected in the “Online device setup” page as shown in Figure 6.
 



Figure 6 Online device setup page showing unit # 21944 on an Ethernet Address
It is a good idea to perform some simple test like “Get Address” command under Setup tab or even go further and set a test route and collect some data using a sensor. If you wish to communicate with the vbOnline device using wireless communication then set up the vb module back to wireless communication using telnet or using the “Change vbOnline:Wifi/Ethernet” dialogue. Stay tuned to see how this is done in a following post.