Successful Endeavours - Electronics Designs That Work!

Embedded Software


Good Documentation

Good Documentation makes it possible for other people to leverage work already done. It can be the difference between something being usable and it being scrapped or ignored. We have already looked at some aspects of how Software Documentation can be created. An example being shown below.

 

Doxygen Call Graph

Doxygen Call Graph

This is only one form of documentation. To use a Software Module you will want the API definition. Here is an example in Doxygen format of a readily usable interface. Not much mystery here. Note that the hyperlinks have been removed to stop is using links you can’t access. Normally every definition is hyperlinked so you can go right to it.

Module MS_RNG

A 32 bit Pseudo Random Number Generator which passes the Die Hard test suite for randomness. It also provides 8 and 16 bit random numbers and a complex seed arrangement.

Functions
void MS_RNG_Seed (U32_t seed1, U32_t seed2)
use the seed values to churn the seed as much as you can
U32_t MS_RNG_Get_U32 (void)
get the next U32 value in the random number sequence
U16_t MS_RNG_Get_U16 (void)
get the next U16 value in the random number sequence
U8_t MS_RNG_Get_U8 (void)
get the next U8 value in the random number sequence

Function Documentation

U16_t MS_RNG_Get_U16 ( void  )

get the next U16 value in the random number sequence
Returns U16 random number

 

  U32_t MS_RNG_Get_U32 ( void  )

get the next U32 value in the random number sequence
Returns U32 random number

 

U8_t MS_RNG_Get_U8 ( void  )

get the next U8 value in the random number sequence
Returns U8 random number

 

void MS_RNG_Seed ( U32_t  seed1,
U32_t  seed2 
)

use the seed values to churn the seed as much as you can

Parameters

seed1 = first seed component
seed2 = second seed component

Returns void

So it should prove straight forward to use a module documented like this. Of course I’ve picked a simple example.

O’Reilly recently published a great article on this and so I’m going to summarise here and you can check out the full article for the rest of the details.

  • Write documentation that is inviting and clear
  • Write documentation that is comprehensive, detailing all aspects of the project
  • Write documentation that is skimmable
  • Write documentation that offers examples of how to use the software
  • Write documentation that has repetition, when useful
  • Write documentation that is maintained and up to date
  • Write documentation that is easy to contribute to
  • Write documentation that is easy to find

Seems perfectly sensible to me. If you want you software to be reused, make it as inviting as possible for subsequent developers to be able to engage with, understand, and quickly leverage what you have already done.

You can read the complete article at the eight rules of good documentation.

Successful Endeavours specialise in Electronics Design and Embedded Software Development, focusing on products that are intended to be Made In AustraliaRay Keefe has developed market leading electronics products in Australia for more than 30 years. This post is Copyright © 2018 Successful Endeavours Pty Ltd.

Software Development Estimation

in Software Costing we looked at some typical ways of determining the likely cost of a Software Development project. One way was to look at how much typing was involved. This is not considered the best approach as the cartoon below demonstrated.

Software Estimation

Software Estimation

I prefer to spend more time thinking about the problem and less time typing. Among other things this reduces the amount of typing required.

The other example was by looking at the study by VDC Research where the median Software Development project had a cost of US$12.5o per line of code. Which is also very expensive by our reckoning. But these are actual figures. The hard part is working out how many lines of code (LOC) will be required before you have written them.

Estimation by Function Points

So I was interested when The Embedded Muse, a software development newsletter authored by Jack Ganssle, published some data from Capers Jones who is a legend in the Software Development industry for his statistics on the Software Development Process.

Capers Jones & Quote

Capers Jones & Quote

My first thought was that I fully agree with the quote. Let’s have a look at it in detail.

High-quality software is not expensive. High-quality software is faster and cheaper to build and maintain than low-quality software, from initial development all the way through total cost of ownership.

The assertion is that if you have a way to measure Software Quality, and you stick to good Software Development Process and the creation of High Quality Software, the overall cost will be lower. This might seems counter intuitive to some of our prospects given the development process requests we get, but I think it is spot on. Here are the other items of interest.

According to Capers Jones, a very rough guide to estimating the number of people needed on a project, and the project’s duration, is:

  • Number of developers = (function points)/150
  • Calendar months = (function points) x 0.4
  • One function point is approximately 130 lines of C Code

So for a typical 20,000 lines of C Code project, we would expect 154 function points with 1 developer required and it would take 5 years. If I look at one of the Industrial Control projects we did then that was 60,000 lines with 3 developers (that part works) and 8 months overall (rather than 5 years). So I’m not convinced the time component of the formula works. Maybe it is too heavily influenced by larger projects. But the number of developers seems to be about right.

Again, these are actual project figures and not some abstract model. And if you don’t use good Software Development Process then the cost of debugging and fixing issues in the field will typically dwarf the cost of writing the code.

Software Development Metrics

So I thought I’d do a summary of the Software Development Metrics we have accumulated over time as this may help with the Software Estimation process. This is what it looks like in our world of typically smaller projects (less than 100K LOC) reflected through the data above:

  • Number of developers = LOC  / 20,000
  • Number of months = LOC / ((number of developers) x 6600)
  • Cost of development = $4.80 per LOC

This assumes good process and average project difficulty. Things that will push a project way past this are code space constraints, processing power constraints, poorly defined requirements and substantial changes of direction mid project. But it does give some way to at least know the ballpark.

Successful Endeavours specialise in Electronics Design and Embedded Software Development, focusing on products that are intended to be Made In AustraliaRay Keefe has developed market leading electronics products in Australia for more than 30 years. This post is Copyright © 2018 Successful Endeavours Pty Ltd.

C Programming Language

The C Programming Language was developed by Dennis Richie and Ken Thompson at Bell Laboratories between 1969 and and 1973. It was the successor to B and used to create Unix. The recent bad experience with the Multics time sharing operating system development had made Bell Laboratories sensitive to that sort of cost blowout so the project was not widely promoted until the first working version was complete.

Ken Thompson and Dennis Ritchie

Ken Thompson and Dennis Ritchie

So what did C bring to the table that made it such a valuable asset? Here is a list:

  • can be used to directly interface to and manipulate hardware and IO
  • so it allows you to get close to the hardware itself
  • was a procedural programming language supporting structured programming
  • can be used to write an operating system
  • or sits very close to the operating system
  • had flexible naming conventions
  • had flexible memory allocation (static, local, global and dynamic)
  • could be compiled to machine language with a relatively simple compiler
  • is portable (mostly)
  • compiles to very fast executing code
  • compiled program can run without an operating system and do not need a virtual machine or any other components

The disadvantage compared to more modern procedural programming languages is that you usually do more typing to achieve the same outcome, it isn’t object oriented by nature and the variable typing is flexible so you can create some spectacular program failures if you get the cast wrong or convert a void pointer (no type associated with it) to the wrong data type. And one big compatibility issue is Endianness where different computing architectures store multi-byte data with the high byte at the top or bottom of the word so you can’t just swap binary data and expect it to always work. So you surely you would think we would have moved on to something better?

Programming Language Usage Trends

A recent study of computer language trends over the past 10 years by Embedded Gurus shows that unlike the anticipated rise of the C++ Programming Language in embedded systems, the use of C is rising and C++ falling. You can read the full article at C: The Immortal Programming Language where we see that Assembly Language use is falling as expected, the use of  C Programming Language is actually rising.

Programming Language Use Trends

Programming Language Use Trends

Now to be clear, this is for Embedded Software Development. In Top Programming Languages 2017 we see that Python is the most used programming language in the world across all domains with the  C Programming Language coming in second overall. This is a very big jump for Python but also a jump for the C Programming Language.

Successful Endeavours Programming Languages

At Successful Endeavours the majority of our embedded systems code is written using the C Programming Language . Our Windows code is a mixture of C and C++. For website development it is PHP and Python. So that’s 4 of the top 10 programming languages listed in Top Programming Languages 2017 .

Top Programming Languages 2017

Top Programming Languages 2017

So I expect we will be continuing to program systems using C for quite some time to come. Especially smaller system that don’t have an Operating System. Now maybe someone should focus a but more attention on teaching C to the next generation of programmers.

Successful Endeavours specialise in Electronics Design and Embedded Software Development, focusing on products that are intended to be Made In AustraliaRay Keefe has developed market leading electronics products in Australia for more than 30 years. This post is Copyright © 2018 Successful Endeavours Pty Ltd.

Embedded Systems Safety

In The Internet of Insecure Things we got a glimpse into the source of some of those security issues. Today we benefit from another infographic reproduced courtesy of the Barr Group. This time it is a look at the underlying Software Security that is so important to improving the future and no making it even more vulnerable. So read through the list of areas you might not be paying enough attention to. I know there are a couple we are still working on.

The State Of Embedded Systems Safety

The State Of Embedded Systems Safety

Food for thought. Above I reproduced a low resolution version with their permission. You can get a full resolution version by registering at the Barr Group website.

Successful Endeavours specialise in Electronics Design and Embedded Software Development, focusing on products that are intended to be Made In AustraliaRay Keefe has developed market leading electronics products in Australia for more than 30 years. This post is Copyright © 2018 Successful Endeavours Pty Ltd.

Insecurity in Cyberspace

This is not one of those topics that makes you feel better initially. In IoT Security we looked at how the emerging IoT world needed to protect itself against attacks. This is a different problem to pure Software Security which has its own challenges.

It was with recent interest that I received a copy of the Barr Group 2018 Embedded Systems Safety & Security Survey . We contribute and so get access to a free copy. I recommend you do the same if this is an area of interest.

They have also put together an infographic that speaks to the The Internet of Insecure Things and I am reproducing a low resolution version here with their permission. You can get a full resolution version by registering at the Barr Group website.

The Internet Of Insecure Things

The Internet Of Insecure Things

It speaks to where the insecure aspects come from. As usual, better Embedded Software Development practice leads to better and more secure products.

Successful Endeavours specialise in Electronics Design and Embedded Software Development, focusing on products that are intended to be Made In AustraliaRay Keefe has developed market leading electronics products in Australia for more than 30 years. This post is Copyright © 2018 Successful Endeavours Pty Ltd.

Intellectual Property

Intellectual Property, or IP as it is abbreviated, is a very important topic. So what is Intellectual Property?

Intellectual Property

Intellectual Property

The diagram above shows some examples. Here are some more examples of Intellectual Property that specifically apply to the Electronics Design and Embedded Software Development:

  • Patents
  • Copyright
  • Industrial design rights
  • Plant varieties
  • Trademarks
  • Trade dress
  • Trade secrets

Copyright applies to things such as:

  • specification and requirements documents
  • reports
  • source code
  • schematic designs
  • PCB layouts
  • Bills of Materials (BOMs)
  • Product assembly and test instructions
  • source code
  • this blog

So a lot of the value created in a new Product Development project is bound up in the Intellectual Property generated.

Why this is important, is that many individuals and companies that offer Product Development services do not give you Intellectual Property Rights to the product you paid them to develop for you. We have picked up quite a few projects over the years where this lead to a toxic relationship between the client and the developer and they needed to go elsewhere.

Protecting your Intellectual Property

To protect your Intellectual Property the obvious steps are:

  • Have a non-disclosure agreement in place prior to sharing any information with another party
  • Ensure all staff and contractors have signed a non-disclosure agreement
  • Check out patents early. Both to determine if you might be able to patent, and also to make sure you aren’t violating anyone else’s rights.
  • Although Copyright vests automatically in Australia, do use Copyright notices
  • Make everyone clear on what you Intellectual Property Policy is
  • Register designs and trademarks
  • Also purchase relevant domain names

Intellectual Property Policy

A question we are often asked is “What is your Intellectual Property Policy“?

Here is how we handle IP including our own which we can license into your project to save both time and cost:

  • IP developed for you is owned exclusively by you and not used for any other purpose
  • IP provided by you is owned by you and only used for the purpose it was provided for
  • we will not share anybody else’s IP with you without their prior permission
  • we will not share your IP with anyone else without your prior permission
  • the non-exclusive license to our background IP is a single purchase at an agreed price and can be leveraged across multiple products
  • where improvements in our background IP become available, they can be incorporated into your product and only the modification cost applies
  • we regular sign non-disclosure agreements and even have one of our own you can use if you don’t have a suitable one yourself

And the last part is usually about how we charge for all this. The are specific costs associated with generating your exclusive IP for a product. Where variants are then designed, only the adaption or variation cost will be incurred. So for instance, changing from one NB-IoT vendor’s cellular modem to another modem from another vendor will only cost the PCB changes and code modification costs and would be expected to be substantially less cost than the initial implementation.

Another way to put all this, is that if you pay for it, you own it without any encumbrance.

Our aim is to ensure your success so it doesn’t make sense to make it difficult for you to own and exploit your own Intellectual Property.

And a little humour to finish off.

Copyright Humour

Copyright Humour

Successful Endeavours specialise in Electronics Design and Embedded Software Development, focusing on products that are intended to be Made In AustraliaRay Keefe has developed market leading electronics products in Australia for more than 30 years. This post is Copyright © 2017 Successful Endeavours Pty Ltd.

Smart Cities

This follows on from our look at Smart Cities and the technology mix being considered for how you implement them. For this post we will look at the development of a Smart City Telemetry sensor suite and the ICT communications that go with it. This is also a classic IoT case study.

I also want to point out that a Smart World will only happen if we have Smart Regions, Smart Countries, Smart States or Territories, Smart Cities and Smart Neighbourhoods.

arcHUB

My thanks go to The Active Reactor Company for giving me permission to share their story about the development of the arcHUB Telemetry sensor suite which is aimed at the Smart Cities programs as well as being more widely deployable.

arcHub Telemetry Module

arcHub Telemetry Module Logo

A few days ago I had the opportunity to speak with Daniel Mulino who is the State Member for Eastern Victoria. The picture below comes from his visit to our office in Narre Warren. The original post he made along with my explanation is here. I’m giving a more detailed explanation below including some history.

Ray Keefe - arcHUB - Daniel Mulino

Ray Keefe – arcHUB – Daniel Mulino

For those wondering about the device I am holding, it is an arcHUB Smart Cities Telemetry module aimed at Smart Cities projects and environmental monitoring where you don’t have access to, or want the cost of, connecting up mains power. This is designed for The Active Reactor Company and is already involved in 1 Smart Cities deployment and multiple trials of low cost sensor modules by councils and government agencies in 3 states. I can’t yet provide specific details on those as they are covered by non-disclosure agreements.

To understand how we got here, it helps to know the history.

The Active Reactor Company make a product called The Active Reactor. It improves both the efficiency and the life of arc lamps such as low pressure sodium street lights, high pressure Sodium  and metal halide lamps.

The Active Reactor

The Active Reactor

With the advent of LED street lighting their current product is not needed for new installations and so they wanted to secure the future of the business. So a great example of addressing an issue that will arise in the future so you are ready for it rather than just reacting to it once it happens.

Initially the new product was aimed at monitoring LED street lights. One of the big issues with LED lighting is that the LEDs either fail over time or they fade and lose brightness. Or a mixture of both. The fading is a result thermal diffusion in the semiconductor substrate. When they fall by more than 30% then you have to address that as they no longer comply with legal standards for lighting levels. The other catch is that the claimed life of 10+ years isn’t yet proven and so it is expected that there will be many lights that fail early or fade early or both.

Of course, once you have a communicating device that can monitor one thing and report it, it can also monitor other things and report them as well. Plus there were issues with being allowed to monitor the light. And where would the power come? Their inquiries with authorities responsible for the poles would not give permission to tap the power in the pole or light.

So this set us the follow set of constraints to work within:

  • must be battery operated
  • easy to install
  • low cost to make and also run
  • communicate using the cheapest data transport
  • monitor the LED light at night and keep track of the brightness trend
  • send an alert when it is persistently out of specification
  • field life to match the street light (10+ years)

As The Active Reactor Company talked to target users (initially the same people who buy their current product) and got an idea of what they wanted, a very different picture emerged. The people who cared about LED street lighting, also cared about micro climates, and soil moisture levels, and air quality, and foot traffic, and …

So that lead to a change of direction and a look at what else was required. The result is a device aimed at the Smart Cities market that also suits a wide range of other end customers and has the following features you won’t find combined together in conventional devices:

  • battery operated (either solar charged or primary cells)
  • minimum 2 year battery life for standard AA cell alkaline batteries
  • 10+ day running time if solar charging is lost
  • up to 20 days on board non-volatile storage
  • compact form factor
  • multiple sensor types per node (up to 20)
  • sensor area network to minimise data costs
  • over the air firmware upgrades
  • over the air configuration updates
  • variable sample rates and upload timing
  • still has to be low cost to make and also run
  • easy to install

So here is the range of sensors already trialed:

  • wind speed (external anemometer attached)
  • sunlight level
  • night light level (street light monitoring etc)
  • temperature
  • PM2.5 particulate levels
  • PM10 particulate levels
  • Gasses – CO, H2S, SO2, NO2, H2S
  • Humidity
  • People counting (PIR based anonymous counting)
  • Soil moisture levels (external probe)

It is also the HUB and coordinator of a Sensor Area Network that can include modules that can measure any of the above as well as:

  • vibration
  • shock
  • movement
  • water level
  • GPS location
  • USB charger current (for usage analysis)
  • counting any device or system that has a pulse output
  • analog voltage measurements (AC and DC)
arcHUB trial at Fitzroy Gardens

arcHUB trial at Fitzroy Gardens

The arcHUB is solar powered and includes a cellular modem to allow reporting back to a web service. It is designed to mount to a pole using straps but can easily be mounted to a wall or any other typical structure. A typical scenario is measurements every 15 minutes (except people or pulse counting which are continuous) and uploading to the web service every hour.

With the release of CAT-M1 services across Australia by Telstra, we are expecting migrate to this communications standard because it will reduce power consumption by at least a factor of 4 which will further improve battery life.

Quectel BG96 CAT-M1 Module

Quectel BG96 CAT-M1 Module

The arcHUB Peripheral Modules connect via 915MHz ISM Band communications and use standard AA batteries. They can run for between 2 and 5 years depending on what sensors are attached and how often they are read and reported. If you used primary lithium cells then you can expect life beyond 10 years.

The arcHUB Peripheral Modules are also capable of stand alone operation with the addition of an internally fitted cellular modem so you can have a portable people counter module that can be easily moved to a new location and doesn’t require an electrician to install it.

And pretty exciting to also announce that this is not only a designed in Australia product range, but it is also a made in Australia product range.

Again, my thanks to The Active Reactor Company for permission to share this story and if you want to know more, leave a comment and I will put you in touch with them.

Successful Endeavours specialise in Electronics Design and Embedded Software Development, focusing on products that are intended to be Made In AustraliaRay Keefe has developed market leading electronics products in Australia for more than 30 years. This post is Copyright © 2017 Successful Endeavours Pty Ltd.

Software Costing

There is an old saying that goes something like this: “hardware is almost free and comes from China; but software is actually free and comes from India”. Actually not such on old saying, and certainly not true. But we do see signs of this myth being alive and well when providing project pricing and estimates for new clients. I covered some of this in Software Estimation.

Software Estimation

Software Estimation

This was about how to try and work out a Software Development Budget in advance. Including forgetting that the entire Software Development Process involves more than just typing. So is it possible to know what it really  costs from real world (non-imaginary) data?

Software Cost

The answer is that it is. My thanks got to VDC Research who recently did a survey of Embedded Developers and made the data available to subscribers of The Embedded Muse, a software development newsletter authored by Jack Ganssle. If you develop software, especially for Embedded Systems, I recommend you sign up if you aren’t already a subscriber.

Jack Ganssle

Jack Ganssle

Here is a summary of some statistics that gave me insights into real Software Development Costs.

Average Median
Project Team Members 19 7
Project Cost $27,000,000 $250,000
Lines of Code 627,000 20,000

So that is a big spread. Our projects are often below the median level shown here so I was interested to work out what these statistics translate to in cost. The $ are all USD$. And the large lines of code average probably represents larger projects using a major Operating System such as Linux as part of the project.

Cost per team member Cost per line of code
Average $1,421,052 $43.06
Median $35,714 $12.50

My first thought is that we don’t charge enough if these are industry typical figures. A bit more thinking shows the process costs of much larger systems. As far as I know there would be few software developers actually getting $1M for their part in the project. And there will be tools costs also included. The statistic missing for me was the duration the money was spent over. We typically budget $5 per line of code for larger projects (20K lines is a decent sized project for a small embedded system) and $2.50 for smaller ones (say 5K lines of code of less).

So there you have a really rough way of estimating cost based on Lines of Code and number of Software Developers involved.

The above is a very small example of the data collected by VDC Research so consider signing up if you want to see all of it.

Software Lines of Code

Software Lines of Code, or LOC, is only one measure of a project. There is much more to consider. We had a recent project where we were asked to fix 50K lines of code for a product that was proving unreliable. So I ran RSM over the top of it to get the average Cylcomatic Complexity and got 6.2! Those who know what that means probably have no idea how you could write code that hard to debug. And no, it wasn’t lots of switch statements. So is the correct answer $250K at $5 per line of code for a complete rewrite?

The answer is a resounding “NO”!

And the reason is because we redesigned the control flow and changed the UI to a table driven design and reduced a spaghetti mess of 50K lines of code down to 10K lines of cleanly designed code. Which is a budget more like $50K. In this case, it was much more cost effective to redesign from scratch than to try and rescue it. We also fixed the hardware design as that was in part responsible for the unreliability.

So the other answer is that good requirements analysis and good design will reduce Software Cost.

Successful Endeavours specialise in Electronics Design and Embedded Software Development, focusing on products that are intended to be Made In Australia. Ray Keefe has developed market leading electronics products in Australia for more than 30 years. This post is Copyright © 2017 Successful Endeavours Pty Ltd.

Programming languages

It is 2016 and we are a long way from the 1970s. So of course the world has moved on. Today’s programming has advanced significantly and we have super low powered systems of extraordinary capacity and easy to program securely. Surely!

Or should that be surely?

So here are the IEEE top programming languages for 2016.

Top Programming Languages 2016

Top Programming Languages 2016

This isn’t the first time we have done this. If you go back to Top Programming Languages 2015 you will see that C was second and Java was first. This year, C is first. A 1970s language is back to being first for all programming in 2016. Why?

It is called the Internet of Things or IoT.

So is this a step backward?

In 2016 devices shipped in the product category known as the Internet of Things exceeded all other mainstream electronics device categories. Take all mobile phones, tablet computers and iPads, desktop computers, netbooks, laptops, servers and general computing devices combined, and this is less than the value of products shipped in the category of the Internet of Things.

And this is what is driving the use of the C programming Language. For these small, low powered, low cost, essential to our future devices, have to be programmed in something that lets you get close to the hardware so you can manage it, and also operate in a high level language. My hat goes off to Dennis Richie and KenTompson who developed this language in the early 1970s and gifted it to us all. Their vision has carried an entire civilisation forward.

Ken Thompson and Dennis Ritchie

Ken Thompson and Dennis Ritchie

So more than 40 years later, I am still very grateful for their foresight, vision and competence in creating the most used computing language on earth today.

Successful Endeavours specialise in Electronics Design and Embedded Software Development, focusing on products that are intended to be Made In Australia. Ray Keefe has developed market leading electronics products in Australia for more than 30 years. This post is Copyright © 2016 Successful Endeavours Pty Ltd.

Top Programming Languages

We previously look at the Top Programming Languages for 2014 and IEEE Spectrum have released the same information for 2015.

Top 10 Programming Languages 2015

Top 10 Programming Languages 2015

One interesting thing is that use of C, the oldest of the top 5 languages, is increasing.

You can read the full article at The 2015 top ten programming languages including how they assessed which languages are used. They also have a App you can purchase if you want finer detail and to always be up to date.

Successful Endeavours specialise in Electronics Design and Embedded Software Development. Ray Keefe has developed market leading electronics products in Australia for nearly 30 years. This post is Copyright © 2015 Successful Endeavours Pty Ltd.

Next Page »