Thursday, October 11, 2018

List of current and future jobs to be impacted by current trends in robotics and automation

Few days ago my wife and I were talking about how automation will impact us and people in our age group, but not necessarily the next generation, and how it will reshape the society we live in over the next 10 or 20 years, and who will be impacted, whether good or bad, more than the others, so I decided to convert our conversation into a compilation of automation technologies introduced to different market segments and jobs:
-         The most famous trend in automation these days is the self-driving vehicles”, almost every automotive manufacturer, plus a handful of tech giants and start-ups are developing self-driving vehicles. And though the experimentation was on small commercial vehicles that can transport 2-4 people, now the development expanded to trucks and mass transportation vehicles like buses and trains. So imagine in the next 5-10 years the following jobs will be impacted: cab drivers, personal drivers (chauffeurs), truck drivers and train operators. A very famous example is Vancouver’s Skytrain, a fully-automated, driverless train system operating since 1986. So transit automation isn’t something new, just it’s trending now with the advances in different technology like AI, computing hardware and sensing technologies.
-         Another job that started to disappear is “cashier”, already many grocery stores around the world started to have “self-checking” kiosks with minimal staff to support its operation.
-         Another field automation and robots are coming for is construction, few days ago Japan’s Advanced Industrial Science and Technology released a video footage of a humanoid robot installing a “drywall”. Also, many of us have watched the giant home-building 3D printer capable of building a small home in 24 hours, so the next wave in automation might hit “construction workers”.
-         With the evolution of optical characters recognition algorithms jobs like “data entry” will disappear in the near future, and a famous example is depositing cheques through banks ATM machines to individuals’ accounts by scanning and recognizing the bank account numbers from the cheque.
-         Policing and law enforcement, and I know it sounds too much like sci-fi, but Dubai announced in 2017 that it will start using robots for police patrolling in some areas. Already drones have been used by the police forces to patrol and roam around roads and highways for few years now. And think about it, it makes a lot of sense and seems realistic, and it will eliminate some of the dangers police personnel face every day in the field.
-         Defence and military, origins of automation can be traced easily to the military, the first attempt was in 1915 during the WWI when engineers tried to build a “flying bomb” (term borrowed from Wikipedia) using a small, single engine plane and a gyroscope for navigation. Then Nazi scientists came up with a more advanced version in the WWII they called Vergeltungswaffe-1, or shortly V-1 (a cousin to the infamous V-2 rocket, the grandparent of ICBMs), and race for automation in military never stopped since then, with more advanced drones, inter-continent missiles, ground, naval and airborne reconnaissance drones and vehicles, satellites (most of them are full automated), a very long list of applications that have been roboticized, last but not least Texas police in 2016 used a “killer robot” to terminate a suspect of killing 5 police officers after a standoff. So, imagine with me future wars with less boots on the ground and armies of robots. I won’t be surprised if it reminded you of the “Terminator” entry scene.
-         In “Medicine”, and bear with me. This area is still at a very early stage but showed promising results. With its ability to scan and compare massive amounts of data, AI showed the capability to discover cancer traces in a patient MRI scan, this year a team from France, Germany and the US developed an AI system was able to detect cancerous moles with accuracy of 95%, so imagine doctors and lab technicians won’t need to go through the different scans anymore, where an AI powered system might take over this task. Robot-assisted surgery already exists since the early 2000’s, with the power of AI, surgical robots might be capable of operating autonomously with minimal supervision, opening the door to another field for automation to invade.
-         Space and Astronomy, whenever the word “space exploration” comes up most of us imagine a guy looking at the stars through one of these giant optical telescopes, and that was true till the early 20th century, which changed completely after the invention of radio frequency telescopes and radioactivity-based space detectors, which brought the space exploration to a whole new level, including massive amounts of data on space. In December 2017 NASA announced the discovery of Kepler-90i, the 8th planet in a sun-like solar system that is 2545 light-years away from us, using an AI system designed by Google. That opens the door to replace scientists and researchers for tasks like scanning the skies and developing conclusions about different celestial objects.
-         Servicing in food industry (waiters and chefs), automated restaurants in Japan replaced waiters with touch-displays for ordering and conveyor-belt system for delivery. Dominos’ pizza started delivering pizza using a self-driving car in Nevada. And last but not least, Moley, a London based tech company, developed a “Robotic Chef”, a robot that can be programmed to cook anything and everything without any human assistance or supervision. So, the day where you gonna email or message your favourite meal or request to your home robot-chef to cook dinner for you isn’t far away.
-         Nuclear waste handling, one of the most dangerous jobs on the planet where robots proved they can do perfectly, robots have been used extensively in Fukushima nuclear disaster site to pick up nuclear waste and perform measurements in the vicinity of nuclear reactor core where it’s extremely dangerous to send humans.
And the list will go on for various jobs and tasks that will be lost to automation and robots in the next few years. So, let me stop here and leave the rest for you. Sources and supporting materials are listed in the first comment. And my apologizes for any grammatical mistakes.

Update (as of February 2020):
-        Epidemics and diseases outbreak prediction: epidemiology is the latest field AI has gotten into and proved to be successful & useful. One of the early alarms on the outbreak of the SARS-CoV-2 Coronavirus disease 2019 (COVID-19) came from BlueDot, a Toronto-based startup that uses AI to develop "infectious disease surveillance" tools. One of their algorithms was tracked the virus spread and issued an alert to the public by scavenging foreign news reports, airlines ticketing data and different online resources on animal and plant diseases. The BlueDot algorithm sent the first alert for the coronavirus spreading in late December 2019, at least one week before WHO announced that coronavirus has become a global health concern.

Sources and supporting material:
-         History of Skytrain:
https://www.translink.ca/About-Us/Corporate-Overview/Operating-Companies/BCRTC/History-of-SkyTrain.aspx
-         Tesla Self-Driving Demonstration:
https://www.tesla.com/en_CA/videos/autopilot-self-driving-hardware-neighborhood-long
-         This Japanese robot contractor can install drywall: https://www.theverge.com/2018/10/1/17923442/aist-japan-humanoid-robot-drywall-hrp-5p-construction
-         3D Printed House Took 24 Hours To Build:
https://www.youtube.com/watch?v=GUdnrtnjT5Q
-         Meet The Terrifying New Robot Cop That's Patrolling Dubai: https://www.forbes.com/sites/susannahbreslin/2017/06/03/robot-cop-dubai/#463087b66872
-         11 Police Robots Patrolling Around the World:
https://www.wired.com/2016/07/11-police-robots-patrolling-around-world/
-         Police used a robot to kill - The keyquestions: https://www.cnn.com/2016/07/09/opinions/dallas-robot-questions-singer/index.html
-         The U.S. Army Is Turning to Robot Soldiers:
https://www.bloomberg.com/news/articles/2018-05-18/the-u-s-army-is-turning-to-robot-soldiers
-         AI cancer detectors:
https://www.theguardian.com/technology/2018/jun/10/artificial-intelligence-cancer-detectors-the-five
-         How AI-Assisted Surgery Is Improving Surgical Outcomes: https://www.roboticsbusinessreview.com/health-medical/ai-assisted-surgery-improves-patient-outcomes/
-         Artificial Intelligence, NASA Data Used to Discover Eighth Planet Circling Distant Star: https://www.nasa.gov/press-release/artificial-intelligence-nasa-data-used-to-discover-eighth-planet-circling-distant-star
-         Exploring a automated sushi bar in Japan-cheeseburger sushi: https://www.youtube.com/watch?v=CuOnMlxmycw
-         Domino's Pizza tests driverless car delivery:
https://www.cbc.ca/news/technology/dominos-pizza-ford-self-driving-car-1.4266349
-         Self-Driving Pizza Delivery Car:
https://www.youtube.com/watch?v=5BEugKgdrxU
-         Robotic Chef Does All The Cooking For You:
https://www.youtube.com/watch?v=SQjXaTlGHIY
-         The Robot Assault On Fukushima:
https://www.wired.com/story/fukushima-robot-cleanup/
-         An AI Epidemiologist Sent the First Warnings of the Wuhan Virus:
https://www.wired.com/story/ai-epidemiologist-wuhan-public-health-warnings/

Monday, June 11, 2018

MCP2221 Tutorial - I2C Interfacing made easy

What is MCP2221?
MCP2221 is a USB to UART & I2C bridge integrated circuit from Microchip Technologies; I would highly recommend reading this tutorial first for further information on it.

How can the MCP2221 be beneficial to me?
Well, if you want to build a computer control and/or data acquisition unit via USB to an I2C slave device without the hustle of using a microcontroller or an Arduino, and less expensive than both of them, the MCP2221 is a good option, it acts as a master I2C device, and it can be programmed easily using its DLL from Microchip on Windows OS, or by configuring it as a USB-I2C dongle on Linux. Another advantage for the MCP2221 that it comes in a PDIP package, which makes it convenient for breadboard prototyping and testing.

What is I2C?
In brief, it is a low speed, master-slave serial communication protocol that uses two lines: data line, named SDA, and clock, named SCL. It is mainly used for sensors interfacing, low speed ADC/DAC or any similar integrated circuits. According to the I2C standard, the maximum speed is 3.2 Mbits/sec between a master and slave but the MCP2221 supports only up to 400 KHz bit rate.
For more C examples for the MCP2221, please visit this GitHub repository. 



Example Code:


#include <stdio.h>
#include "mcp2221_dll_um.h"

//Linking the MCP2221 library, only valid for Visual Studio
#pragma comment(lib, "mcp2221_dll_um_x86.lib")

#define I2cAddr7bit 1
#define I2cAddr8bit 0

//Global variables
void *handle;
wchar_t SerNum = 0x0000075428;
wchar_t LibVer[6];
wchar_t MfrDescriptor[30];
wchar_t ProdDescrip[30];
int ver = 0;
int error = 0;
int flag = 0;
unsigned int PID = 0xDD;
unsigned int VID = 0x4D8;
unsigned int NumOfDev = 0;
unsigned char PowerAttrib;
unsigned char DacVal = 31;
unsigned char SlaveAddress = 0x63;
unsigned char TxBuffer[8];
unsigned char RxBuffer[8];

//Functions prototypes
void ExitFunc();
void Mcp2221_config();

void ExitFunc()
{
    Mcp2221_CloseAll();
 Mcp2221_Reset(handle);
}

void Mcp2221_config()
{
    ver = Mcp2221_GetLibraryVersion(LibVer);  //Get DLL version
    if(ver == 0)
    {
        printf("Library (DLL) version: %ls\n", LibVer);
    }
    else
    {
        error = Mcp2221_GetLastError();
        printf("Version can't be found, version: %d, error: %d\n", ver, error);
    }

    //Get number of connected devices with this VID & PID
    Mcp2221_GetConnectedDevices(VID, PID, &NumOfDev);
    if(NumOfDev == 0)
    {
        printf("No MCP2221 devices connected\n");
        //exit(0);
    }
    else
    {
        printf("Number of devices found: %d\n", NumOfDev);
    }

    //open device by S/N
    //handle = Mcp2221_OpenBySN(VID, PID, &SerNum);

    //Open device by index
    handle = Mcp2221_OpenByIndex(VID, PID, NumOfDev-1);
    if(error == NULL)
    {
        printf("Connection successful\n");       
    }
    else
    {
        error = Mcp2221_GetLastError();
        printf("Error message is %s\n", error);
    }

    //Get manufacturer descriptor
    flag = Mcp2221_GetManufacturerDescriptor(handle, MfrDescriptor);
    if(flag == 0)
    {
        printf("Manufacturer descriptor: %ls\n", MfrDescriptor);

    }
    else
    {
        printf("Error getting descriptor: %d\n", flag);
    }

    //Get product descriptor
    flag = Mcp2221_GetProductDescriptor(handle, ProdDescrip);
    if(flag == 0)
    {
        printf("Product descriptor: %ls\n", ProdDescrip);        
    }
    else
    {
        printf("Error getting product descriptor: %d\n", flag);        
    }

    //Get power attributes
    flag = Mcp2221_GetUsbPowerAttributes(handle, &PowerAttrib, &ReqCurrent);
    if(flag == 0)
    {
        printf("Power Attributes, %x\nRequested current units = %d\nRequested current(mA) = %d\n", PowerAttrib, ReqCurrent, ReqCurrent*2);
    }
    else
    {
        printf("Error getting power attributes: %d\n", flag);      
    }

    //Set I2C bus
    flag = Mcp2221_SetSpeed(handle, 500000);    //set I2C speed to 400 KHz
    if(flag == 0)
    {
        printf("I2C is configured\n");        
    }
    else
    {
        printf("Error setting I2C bus: %d\n", flag);        
    }

    //Set I2C advanced parameters
    flag = Mcp2221_SetAdvancedCommParams(handle, 10, 1000);  //10ms timeout, try 1000 times
    if(flag == 0)
    {
        printf("I2C advanced settings set\n");
    }
    else
    {
        printf("Error setting I2C advanced settings: %d\n", flag);      
    }
}

void main(int argc, char *argv[])
{
    atexit(ExitFunc); //Call exit function

    //Configure any connected MCP2221
    Mcp2221_config();
 
    while(1)
    {
  
  //Write all contents of TxBuffer to I2C slave device 0x63
  flag = Mcp2221_I2cWrite(handle, sizeof(TxBuffer), SlaveAddress, I2cAddr7bit, TxBuffer);    //issue start condition then address
  if(flag == 0)
  {
   printf("Writing to device %x successful\n", SlaveAddress);
  }
  else
  {
   printf("Error writing to I2C device: %x, Error: %d\n", SlaveAddress1, flag);
   Mcp2221_I2cCancelCurrentTransfer(handle);
  }
  
  //Read 8 bytes from I2C slave device 0x63
  flag = Mcp2221_I2cRead(handle, 8, SlaveAddress, I2cAddr7bit, RxBuffer);
  if(flag == 0)
  {
   printf("Data received is %x\n", RxBuffer);
  }
  else 
  {
   printf("Error receiving ack: %d\n", flag);
  } 
    }
}