Automotive Grade Linux

Linux Foundation has collaborated with Automobile companies to bring out a Automative field specific distribution “The Automotive Grade Linux” .

lf_automotive_logo

What is Automotive Grade Linux?

AGL or Automotive Grade Linux is an open collaboration between various industry and open source projects to provide a distribution of Linux for Automotive sector. The Distribution is generic and will contain software stack and framwork and should be ported to target hardware to get the required application. The project uses Tizen as its reference distribution  to provide the framework.

Where Can I use it?

Though AGL does not specify any particular product segment, The current code base points to In-Vehicle Infotainment (IVI). This screenshot taken from the website speaks for all.

Homescreen

Some User Experience packages

Out of that Smart Device Link looks to be one interesting project. Using it, its possible to connect any smartphone to the IVI and literally control using Smartphone App. The  project requires a lot of development and contributions.

Simulate

You can download the reference distribution image from the website and You can run it using VMWare emulator .

For more information visit https://automotive.linuxfoundation.org/

Embedded System Field Upgrade and Maintanance

The advantage of embedded system based products are the software. Once the hardware is well defined and designed with all the future requirements, most of the features are achieved using software. With software it is possible to fix the bug, improve a feature, innovate new ideas and develop them. Most of the embedded system product that are available in the market does have bug and also has upgrades. When a new  product is launched, its software contains the basic feature and an upgrade mechanism. As the product is used to people based on the reported bugs and new feature requirements an upgrade will be provided by the maker.

If the product goes to market without a robust upgrade mechanism, it going to be a mess. Imagine that a product has a software update but it can only be upgraded by the developer working in that project or if the upgrade mechanism is not robust and does not handle all possible unwanted scenario then it will end up in bricking.

So as a part for product development, it is always better to develop a upgrade mechanism. There are several types of upgrade methods possible, it  depends on the hardware and software capabilities and the companies choice of policy.

The upgrade mechanism can be implemented in boot loader or operating system depending on the type of upgrade. Loosely you can classify three types of upgrading technique.

  1. Direct access upgrade

  2. Remote access upgrade

  3. Internet based upgrade

Direct access upgrade
This is much similar to the way a developer working in a project will upgrade the firmware/software to the hardware unit. The hardware needs to be physically available in working state. With the support of boot loader or OS and using any communication interface it can be upgraded.

TFTP
In a typical Linux development environment TFTP based upgrade is used in the development phase. The U-boot is configured to get the firmware images from TFTP server and flash them in predefined address location by sending commands over serial console.

This process is well tested and for development environment it works smooth and fine. But this cannot be used for field upgrade since this setup required a lot of information to be known be the user and chances of failure are high.

USB and Serial
Many products provide USB or Serial based upgrade to the customer. For implementing this the boot loader has to support this feature and there needs to be a PC application which will initiate the upgrade and handle the entire process and provide a visual update on the progress.

The serial port based upgrade is very slow and it is not generally used in upgrading Linux images since it will take at least a day to complete this process. They are mostly used for smaller micro controllers. USB based upgrade are suited for embedded Linux upgrade. The USB based upgrade has a set of standard defined which is called USB DFU. U-boot supported USB DFU standard and for the PC application dfu-util is used.

Remote upgrade
While direct upgrade is quick and easy it is not always the case that happens in the field. The industrial and service oriented companies might find that useful while larger set of consumers and non technical users would prefer a silent upgrade or upgrade without dealing with cables. In telecoms industries the telephones and mobile phones are upgraded Over the air programming.

Internet based upgrade
The Internet based upgrade is very vague way of mentioning the technique, as there are many methods in which Internet can be used to upgrade the device.

In device download 
For this technique the device needs to be a smart phone or other tablet where the user triggers the upgrade process. The upgrade application will then send the information about the firmware to the corresponding service provide. These information are version number of the firmware, disk space available etc.
Then the compressed firmware images are downloaded to the device over Internet connection, and upgraded. It is similar to the OTA but differs in the communication line.

Direct firmware push
If the device is router or any headless similar one, then a web server running in the background for administration can be used as a method to upgrade the firmware. The user uses a browser and uses the device web interface to upload the firmware in to the device. Basically the firmware is packed with all the required information for the device to install the software. In the device there needs to be some script or process that will receive the user-pushed firmware file. After verifying the integrity of the file it will be extracted and installed. The status of the entire process is shown in the browser.

Hybrid flashing
In this method both Internet and direct access is used for upgrading the device. Here the device is connected to the PC via USB and the PC has Internet connection and the credentials to the FTP server which contains the firmwares. The upgrade app running in the PC will check the firmware version and if it is outdated then it will automatically download the latest version from the FTP server and do all the verification in PC and then flash the firmware to the device. By using this technique its possible to get the latest version of the firmware running in the device without much complexity. As for the end user is concerned it will completely abstract the version related overheads and provides a smooth transition. Since the ftp related things are handled in the PC the boot loader does not need to implement the FTP related protocol implementation and hence saves lot of time in development and debugging.

There are even more technique to upgrade a device, but the above mentioned are the common methods used.

Internet of things – Need for standard physical interface

Internet of things is about bringing electronics devices which sits at your home to the Internet. For more information about what it click here. Basically the idea and the intention is to get an IP address to every device and make it talk with other device. The idea is simple and cool, With it its possible to automate so many things around us.

There are plenty of experiments and software available in Internet, for example you can glow a single  LED which is sitting at your home connected to Internet controlled using your smart phone from any where in the world. This is a “Hello World” of IoT. With emergence of low cost open hardware solutions, its possible to literally get anything at home to see the world of Internet with just few connections and some coding work.

But from now on where does it go?. There are so many startups working IoT ready to kick off or already running. Many universities are starting to fund for projects or research in this direction. There is also an operating system made for IoT called Contiki. I have used it for a an experimental Hello world project (see down below) , where two devices communicate using 6LowPAN. 6LowPAN is IPv6 for micro controllers.

Now everything is there almost ready, But wait What do you really want to control?. Where are those devices which really needs control. Glowing a LED, stopping a stepper motor, tweeting from a micro controller are cool to watch but that cannot to be used by everyone, neither it can be called absolutely useful.

What is missing is a standard interface or at least partially standard one. Take automobile industry for example. Every car manufacturer has their own design and intellectual property but when it comes to diagnose them, there is a standard. This On-Board-Diagnostics seems to have started way back in 1969. Now it has matured and also diverse in to several standards. But the point is for a given car there will be at least one diagnostic standard. The physical connector used for this purpose is well defined and anybody can make a diagnostic device. If you have got a micro controller, you can also make one of your own with these low cost connectors like this one.

https://www.sparkfun.com/products/9911

The connector is standard, now you need to write the code for the vehicle  that you want to diagnose. Each pin in the OBD and their protocol  can vary for based on the model of the car. But you can build one if you want.

Now coming back to IoT, You get so many micro controllers with Ethernet interface or wifi interface, Almost everyone has got a smart phone with them, You also have many things that needs to be controlled. What is really missing is an interface something like a diagnostic interface.

Think of what we have at our home, a washing machine, heater, microwave-oven, electric stove. refrigerator etc. Actually these are the things that needs to show up their face in Internet. Well critics can say that there is a potential danger by exposing these things to Internet. By Internet I don’t mean the global Internet exactly but just a network of device within your home all interconnected. You can bring it to the real world Internet at your own risk, wish, need whatever.

Imagine that your smart phone alarms you when you have forgotten to switch off the electric stove or remind you to take clothes out of your washing machine or notify you that the refrigerator is not closed properly. These are very basic things that are needed. Now how to get these things?

Again a diagnostic interface, Every manufacturer has to follow a standard diagnostic interface. They also have to provide a data sheet or command reference. If every device has such connector to it, then its possible to achieve those use cases that I mentioned. For the physical interface, it can be something simple and can provide a robust communication. For example UEXT – Universal EXTension is one connector which is uses quiet familiar and standard protocols and next it is royalty free to use. You get everything what you want from it. I am not any way connected to the creators of UEXT, Neither I endorse it. If I think of a OBD connector and similar to that for home automation, without much complexity to implement it in both device side as well as diagnostic side then this is the one which comes closest with no restriction.

So what does UEXT have?
It has one Asynchronous (Serial)  and two synchronous protocols (I2C and SPI). Any notification from the device can be handled by Serial and any data to be read from the device can use any of the three. The device manufacturer has the choice to select what interface they want to support. Like in OBD, some cars have only CAN interface and other have only Kline etc.

The pin out of UEXT looks like this

Its very small in size and can be fit anywhere the manufacturer wants. It would look like this.

Now after the physical connector defined, the rest is to define a software protocol to work on top of it. While this has to be decided by a consortium or a group of manufacturer sitting together to bring this out.

By doing this, we can achieve few things.
You don’t need to open your device to make automation.
Internet of things will actually be useful.
Open standard so any body can make device to connect with them, this prevents monopoly over the market
Bring each device to a network.
Reuse or Repair or Re code the diagnostic device
and lot more ……

The hello world 6LowPAN that I wanted to show you is

 

 

Internet of Things – Food vending machine

With Internet of things aka IoT trending now, I was trying to find ways and needs where it can be useful for people. Like in my first article about defining a physical interface standard for Internet of Things where it is useful for home appliances, here I am trying to make use of IoT in public places. I’m sure that this is not a new idea somewhere it should have been implemented but not widespread. OK the topic is Food vending machine. If you want to know what is vending machine check this wiki link of vending machine. Lets focus on why I am writing this article. For example, lets say I am returning from a  foreign country and waiting in a railway station. I have finished all my local currency and exchanged all what I had Suddenly I realise that I am thirsty and  hungry and it takes 1 buck to get a bottle of water or a drink. wrong planning. Now you have two choice one go to automat and get money or stay thirsty and hungry. I am not discussing any further options. Second option is terrible.If you take the first option, if you go to an ATM and take some money, you will have extra money which you cant use after returning and neither its an amount to exchange. This can happen in many other situations. If you realise this as a problem then my point is that there is a solution for it using Internet of things.

Here is a vending machine.

(image taken from wikipedia)

You need to put coins or paper notes to get things out of this box. This is quiet understandable. Now what I am trying to explain is this.How to bring IoT to vending machine.Follow the picture and explanation step by step. But let me give you the core idea now. Its about providing a wifi based vending machine with online payment using any of the list of online payment service provider to users

First step

(image taken from wikipedia and openclipart.org)

Yes get wifi to the automat. When user search for free available wifi from PC or smartphone the automat will appear as one of them. Its free. Its limited. You can’t use it for personal needs such as checking email or new etc. Its only for buying things from this automat.

Second step
Next Provide QR code for links for Apps for Android, Iphone or for direct web based usage to buy things.

The free wifi will enable the user to download the app and use it, it will also be possible to use browser to access a website with a id representing that particular automat. Assuming that there is a chain of automat from a particular maker, this one automat will have a unique number which will be part of that QR code.

Now you can pay the cost for the food item that you want to buy using paypal or any other online payment service that you use and get what you want. Here you don’t run to an automat and neither have excess foreign currency that you will not be using later what ever….

How secure and reliable it will work. Yes there are times where you put the coins and the food getting stuck somewhere and you look like a stupid. With Internet this looks like it can happen more.

Yes for that there are two solutions,
1. Once you pay using App, you get notified with a 6 digit number ( any number of digit ) then you enter the digit and you will get what you ordered

2. You pay using app and you get a QR code. After selecting the item, You show that in front of the automat QR scanner and then you get the items you ordered.

Same works for web based solution.

Here the vending machine is connected to the server which is in the Internet. The server provides the user interface and uses API for online payment service providers like PayPal. The list of payment gateway option depends on the vending machine’s website.

How to implement this?
For the start lets take a Raspberry Pi or a Beagle Bone Black as a test machine.
Now We need to get a wifi available to smartphones and PC where its restricted and limited to the usage of vending machine. For that you need some bunch of software.

Access Point:
To provide an access point in Linux you need Hostapd.
To provide a restricted access to a bunch of website you need Captive portal.

Coova Chilli is a good option to choose for this purpose, its walled garden option allows it to restrict the end user to a number of website predefined for a particular usage. Its been used to provide social wifi and proved to be successful.
Why not with food vending machine!!!.

DISCLAIMER:I am not owning or working or in any means connected with the companies or organisations or projects or products such as PayPal, Vending machines companies, Raspberry PI, Beagle Bone black, Coova chill, Hostapd etc. User should use them at their own risk and this article provides only an insight to an idea and does not endorse any product or service whatsoever.