element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Industrial Automation
  • Technologies
  • More
Industrial Automation
Blog AVNET SmartEdge IIOT Gateway: the 2020 Linux Image and IoTConnect Scripts
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Industrial Automation to participate - click to join for free!
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: Jan Cumps
  • Date Created: 11 Dec 2020 12:32 AM Date Created
  • Views 7530 views
  • Likes 6 likes
  • Comments 55 comments
  • raspberry
  • avnet
  • smartedge
  • smartedge iiot gateway
  • iiot gateway
  • linux
Related
Recommended

AVNET SmartEdge IIOT Gateway: the 2020 Linux Image and IoTConnect Scripts

Jan Cumps
Jan Cumps
11 Dec 2020

AVNET published an updated image for the SmartEdge IIOT GatewaySmartEdge IIOT Gateway.

Not a huge leap. It's still Raspbian GNU/Linux 9 (Stretch).

There are some improvements and changes worth updating for. The most important reason is the improved stability.

 

image

 

Some highlights:

  • The CAN driver got an update. There were issues after every other reboot with the original image.
  • It's now safe to call reboot without risk of bricking the device
  • It's safe to upgrade Linux on the device.

 

How to upgrade?

 

edit: avnet released an upgrade script: https://github.com/Avnet/avtse-iiotg-upgrade.

This is easier than the "from image" explanation below.

 

The SmartEdge is family of the Raspberry Pi Compute. You use a rpiboot to load an image.

I noticed that with my device, the Windows and Linux rpiboot didn't work.

If I build the AVNET version from source on a Linux (virtual) machine, it works.

 

sudo apt install libusb-1.0-0-dev

git clone https://github.com/Avnet/smartedge-iiot-gateway-custom.git
cd smartedge-iiot-gateway-custom/rpiboot
make

 

check what drives are available (look for sd* devices)

lsblk

 

unplug the SmartEdge, open it, connect the internal USB to your PC.

check that the jumper next to the USB connector is mounted.

 

sudo ./rpiboot

 

provide power to the SmartEdge

check what drives are added (look for new sd* devices, you should find a new sdX, sdX1 and sdX2)

lsblk

 

You can now use the dd utility to move the image to the SmartEdge (replace the X with the new device that appeared when running lsblk the 2nd time):

sudo dd if=avtse-iiotg-v11-20200326.img of=/dev/sdX

 

 

ntewinkel adds these parameters to see progress and get higher throughput:

bs=4M status=progress

 

Just before finishing, place an empty file called ssh on the boot partition. This will allow you to connect over an ssh terminal (e.g.: PuTTy) as soon as the device is set up. It saves you from having to go find a QUERTY keyboard and monitor.

 

Then you can unplug the USB cable,power cycle the SmartEdge, and use the AVNET's IoTConnect app to set the WiFi. I had to remove the existing device in the app, before searching for the "new" device.

 

The IoTConnect Integration

 

The SmartEdge image installs some services that make it interact with AVNET IoTConnect cloud service.

You get a 30 day subscription when registering your application with the app.

It's worth checking this out, and to try extend the examples.

The example is elaborate right out of the box. It will by default exchange the die temperature. If you attach SmartSensor devices to USB or RS-485, it will initiate those and try to exchange their data too.

You can enable the use of the DIGIO input pins, and exchange their status too.

I will write an article to investigate the scripts for cloud service and other SmartEdge specific services.

 

When not using the IoTConnect services:

 

If you used the original image before, you will have noticed that there are some changes in the way the AVNET IoTConnect scripts are started, and how the device specific hardware is handled in this version

In the first image, more was done in the rc* scripts. All has moved to system services now.

 

If you want to use the device in the intranet, or use another cloud service, it makes sense to disable the services.

This will free the following resources:

  • the custom LED is now available for your own program
  • the device doesn't connect to the internet every so many seconds
  • the I/O pins are pristine.
  • no traffic to RS-485

 

Easiest way: I disabled following services, by navigating to /etc/systemd/system and renaming them from *.service to *.bak:

  • iotconnectservice (connect to AVNET IoTConnect and run the demo)
  • ledservice (control the user LED, attention, also entertains the watchdog)
  • quectel (keep GSM modem connection alive. My box doesn't have the modem)
  • smartedgehalt  (part of the user LED functionality)

None of these changes are impacting. You can rename them back to *.service and you have the demo functionality back.

I left the services related to the reset button and watchdog running.

 

I commented out 2 lines in the reboot script, related to the user LED.

The script makes the led flash fast, and after reboot, that's normally stopped by the ledservice.

If we leave the two lines of code in, we have a flashing LED after reboot.

 

sudo nano /opt/avnet-iot/iotservices/reboot

 

Then at the end, put a # in front of the LED commands:

 

# echo 20 > /sys/class/leds/smartedge_led/brightness
# echo 128 > /sys/class/leds/smartedge_led_duty/brightness

 

 

A little harder but cleaner method: the proper way to disable the services is actually, for each service, stop and disable them.

There is some more work to it, because some of the scripts re-enable services (watchdog stopwd script tries to restart smartedgehalt.service).

If you want to do the exercise by disabling services instead of the rename "hack",

don't rename the .service files to .bak files, and follow instructions below:

 

sudo systemctl stop iotconnectservice.service
sudo systemctl disable iotconnectservice.service
sudo systemctl stop ledservice.service
sudo systemctl disable ledservice.service
sudo systemctl stop quectel.service
sudo systemctl disable quectel.service
sudo systemctl stop smartedgehalt.service
sudo systemctl disable smartedgehalt.service

 

 

Then make the same change to the reboot script as described above.

 

Then similar for the halt script, comment out the line that makes the red let blink at reboot:

 

sudo nano /opt/avnet-iot/iotservices/halt

 

# echo 36 > /sys/class/leds/smartedge_led/brightness

 

And in the stopwd script, prevent that the smartedgehalt.service gest re-enabled:

 

sudo nano /opt/avnet-iot/iotservices/stopwd

 

# systemctl enable smartedgehalt

 

Whether you used the 1st or 2nd method, the result is that the IoTConnect extensions aren't started at boot or reboot, and the red led is no longer used for signaling device / service specific statuses.

Watchdog and reboot service are still active.

 

Other Changes, Watch outs

 

You can now reboot without issues. The Linux default reboot command now points to /opt/avnet-iot/iotservices/reboot.

The reset button works better. A short press calls the above reboot script. A long press (> 10 seconds) resets to factory.

Attention when using the WatchDog service (when you put the watchdog jumper). The Led Service has to run too, because it stops the watchdog and prevents a reboot.

 

The initial image release could become unstable when performing an upgrade.

The user documentation contains the measures to take to avoid this. But at the end of the document, in an addendum.

The new image has these actions taken for you:

$ apt-mark showhold
raspberrypi-bootloader
raspberrypi-kernel
raspberrypi-sys-mods

 

The server isn't recognised by its name on my network. I had to install avahi for that:

sudo apt-get install avahi-daemon

Once that command executed the smartedge published the name it was given in the raspi-config utility.

 

In a later post I'll untangle how the different AVNET services work together.

 

Related Blog
Industrial I/O
Use the Industrial I/O
Control Industrial I/O directly from GPIO Pins
C Program for the Industrial I/O
Control Industrial I/O directly from Node-RED
Display Industrial I/O on Node-RED Dashboard
CAN Bus
Use the Isolated CAN
CAN programming in C on Linux: Filter and Mask
2020 Linux Image
The 2020 Linux Image and IoTConnect Scripts
Understand the Custom Scripts and Services (Pt. 1: intro and reset button service)
Understand the Custom Scripts and Services (Pt. 2: led service)
Understand the Custom Scripts and Services (Pt. 3: IoT Connect service)
  • Sign in to reply

Top Comments

  • Jan Cumps
    Jan Cumps over 4 years ago in reply to ntewinkel +2
    ntewinkel wrote: .... You said that after disabling the services: "> the I/O pins are pristine." Does that mean all of the regular Raspberry Pi pins are useable then? For example, I could hook it up to…
  • Jan Cumps
    Jan Cumps over 4 years ago in reply to ntewinkel +2
    avnet released an upgrade script: https://github.com/Avnet/avtse-iiotg-upgrade I read it but haven't tested. Way easier than starting from fresh image.
  • ntewinkel
    ntewinkel over 4 years ago in reply to Jan Cumps +2
    I see their documentation hasn't improved any. They might have added a few extra notes and guidance into that github readme! side-note, looks like a version 1.3 is in progress too. Best, -Nico
  • Jan Cumps
    Jan Cumps over 4 years ago in reply to ntewinkel

    The 30 days only play a role when using the IoTConnect integration.

    If you don't use it, there is no need to reprovision.

     

    I don't know if standard raspbian will work. If it does, you'd miss the essentials of the device, or have to start figuring it out yourself.

    If you don't need those, thre's no good reason to go for this device.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • ntewinkel
    ntewinkel over 4 years ago in reply to Jan Cumps

    Ugh, that is SO frustrating!

     

    I find that 30 days is never long enough for me, because I only get maybe one afternoon per weekend to try things out.

     

    I think you have said before that the hardware requires a special build of Raspbian, but would a regular build do the trick if I don't want to use the SmartEdge specific ports?

     

    My Raspberry server build project is stalled again - I switched to a Pi3B to avoid any potential SmartEdge hiccups, but I never got far, as I had to return back to renovation work at the inherited house again image

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • Jan Cumps
    Jan Cumps over 4 years ago in reply to Jan Cumps

    I fixed it with the keyboard and monitor. Re-enabled the SSH interface with raspi-config.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • Jan Cumps
    Jan Cumps over 4 years ago

    I have a rough moment with the device again.

    After 30 days, the IOTConnect trial license expires.

    When that happens, and you want to continue evaluating, you have to create a new mail account and a new login.

    Then reset the Iot software package on the device. One of the effects is that you have to provision the device again and it loses the connection to your WiFi.

    From that moment, several things can (in my case will) go wrong.

     

    The previous time, the Avnet IotConnect  Android phone app could not re-provision the device. I had to use someone else's phone to re-connect the device to my WiFi. Once that was done, it was provisioned.

    This time (after writing my blog series and the account expired) I could connect the device to my WiFi again - but it no longer accepts SSH connections. The setting was reset to default: no WiFi over SSH.

    That means I have to remove it from its DIN rail and find a power brick, and wire it to the network. Or get a keyboard and screen in to the  DIN closet.

    It's not efficient for an evaluator. Avnet could put new employees (that never worked with the kit) through the process - using their own mobile phones -  and write down what happens during the exercise. Then let them rate the individual steps from 1 to 5 stars. It can reflect what the outside evaluator experiences.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • ntewinkel
    ntewinkel over 4 years ago in reply to Jan Cumps

    Oh good!

    Thanks for the update image

     

    And I see it's v13a now (with Feb28 timestamp) instead of just v13 (with Jan21 timestamp), so it's likely they fixed a bug.

     

    I think I will re-flash my SmartEdge again just to make sure.

     

    ps, For my home sensors server setup, I've decided to start with a Raspberry Pi 3 I have available. Once I've got that running and am comfortable with all of it, I'll set it all up on the SmartEdge.

    So, kind of a staging and production server setup in a tiny sort of way image

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
>
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube