Interviewing for an entry-level embedded systems engineering position

In my current position, I am often tasked to interview recent college graduates for our internships and also for our entry-level embedded systems positions. Since we are a relatively small company, we are looking for well rounded engineers with some general understanding of embedded software as well as circuit design. We need our new-hires to help designing new circuits at the schematic level, develop software for various micro-controllers and debug faulty circuit boards returned from the field.
Over the last couple of months I have interviewed dozens of candidates and I was shocked to see that the vast majority of these engineers, many coming out of prestigious universities, are unable to answer the most basic questions. I understand that job interviews can be a stressful event, but some of the most basic concepts should be second nature to anyone with an electrical/ computer engineering degree. In this post I will outline our technical interview routine, which does not differ much from other embedded systems engineering entry-level interviews. While the human-resources department is mainly interested in personality fit, the role of the technical portion of the interview, is to assess the candidate skills.

Unsolicited advice from the other side
For the young engineers out there interviewing, I have 4 general suggestions:
1- During the interview, do not drop industry-buzzwords that you don’t fully understand what they mean. For example, don’t say that you love chips manufactured by ARM. ARM does not make chips.
2- Come prepared with a portfolio with some of your work (e.g. source code, circuits, layouts, relevant blog posts) and leave a copy with the interviewers.This makes you look professional and organized.
3- In a technical engineering position no one is interested how cool the candidate was in college or how smart the candidate is for wanting to go to graduate school to learn more. In most companies there is a need for dedicated engineers to design, implement and maintain a project in its entire life-cycle. We simply have no time to train someone for a couple of months, so that they can jump-ship in six months to go to graduate school.
4- Go to interviews dressed business casual. I have noticed that the strongest candidates are usually the ones who don’t over-or-underdress.

Resume skill check
When we start the interview process, the first thing we do is re-read the skills section. If the candidate lists a particular skill, we will inevitably ask some very basic questions about it. For example, if C/C++ is listed as a skill, we generally ask the candidate to tell us the difference between C and C++. Unfortunately, only about 25% of the candidates know this.The simplest answer, as defined by the creator of C++ himself (Bjarne Stroustrup), is that C++ is C with classes.This would be the perfect time to talk about how C++ is an object oriented language and that objects allow the programer to secure (hide) data inside classes.The diligent engineer could also talk about how in C++, two functions can have the same name but different arguments (function overloading) and how variables in standard versions of C need to be declared at the start of each function. Similarly, if you do not understand the difference between Linux and Unix, do not put both on your resume.

Here are some of the commonly listed skills and some possible simple questions about them:
Matlab or Mathematica – Can you put 10 numbers in a 1D Matrix (orTable) and compute their average?
Linux – What is your Linux distribution? What command do you use to create and change a directory?
ASM – What does the command JMP do? What about MOV?
Python or Perl – Can you create a for loop that prints “hello world” 10 times?
HTML What does the and tag to?
Spice – Can you write a spice file with a circuit with a power supply and a single resistor?
Labview – Who makes Labview?

Finally, my recommendation is to avoid listing skills that you don’t fully understand what they mean. One of our candidates listed Xilinx as a software skill.This particular candidate not only did not know that Xilinx was a company, but he also could not remember the purpose of that particular piece of software (“I think it was to program some sort of chip.”).

Assessing the candidate interest in embedded systems
We are always interested in candidates with a passion for anything related to embedded systems, as these tend to be the strongest engineers. We often ask them where they buy their components, what electronics magazines they read and which websites they frequent. We also like to know what is their favorite prototyping system (e.g. arduino, raspi, beagleboard) and favorite programming language.We also like candidates to tell us about how they normally go about testing and implementing their prototypes. For example, how would they go about etching a PCB in their basement? While the answers to these questions are far from being deal-breakers, they do give us an insight about how passionate the candidate is about the field.
We also like our entry-level candidates to know a bit of whats out there. For example, what are the names of some companies that manufacture micro-controllers and the names of their products (e.g. Atmel manufactures ATmega328P which is used in the Arduino prototyping system).

The deal breakers
We have, what we like to call the “five deal breaker questions”. If candidate misses one of them, we cannot in good conscience hire them.
Question #1 – The most fundamental question regarding electrical circuit theory is how to measure current and voltage in a simple circuit. In the interview room we have a very simple circuit with a single resistor in a prototype board. After we power the circuit we give the candidate a digital multimeter and ask them to measure the voltage across, and the current through, the resistor; Voltage levels are measured by connecting the two probes across the resistor, while current is measured by opening the circuit and completing it with the multi-meter connected in series. Surprisingly about 10% of the candidates miss this question.

Question #2 – We need to know how confident the candidate is with basic circuit analysis. We draw on the board a schematic very similar to the one shown on Figure 1 and ask the candidate to determine the measured voltage across R2.

Figure 1 - Interview question: Determine the voltage across R2.

Figure 1 – Interview question: Determine the voltage across R2.

A confident engineer does not have to make any calculations.Two equal resistors in series with 10V across them, means that the voltage across just one of these resistors is 5V. The candidate can also determine this voltage by “hand”:

Ohms law implies that,
V1 = i (R1 + R2)
10 V = i (100 + 100)
So the current through R1 and R2 is 10 / 200 Amps or 20 mAmps.
VM = i (R2) = 10 / 200 * 100 = 10 / 2 = 5 Volts

One quarter of our candidates, most with degrees in electrical engineering had trouble with this question.

Question #3 – We also ask very simple practical design questions. For example, when should you use a transistor instead of a relay in a design? There are many possible answers here, and we are just looking for the basic ones. For example, you can mention that the relay, since it is an electromechanical switch, is much slower than a transistor, but it can usually carry a lot more current. Relays in general are also much bigger than transistors.

Question #4 – It is fundamental that our new hires know the purpose of basic circuit concepts. Here are the three short-answer questions we always ask:

Q:What is a servo motor?

It is a motor in which you can control the precise position of its shaft through a well-defined pulse.

Q:What is a potentiometer?

It is a resistor whose resistance can be changed by adjusting a knob, usually with a small screwdriver.

Q:What is does it mean for a signal to have 30% duty cycle?

It means the signal is in its high-state 30% of the time.

Question #5 – Finally, we always ask the candidate to explain what are the defining characteristics of an OP-AMP. Most candidates are able to tell us that the V+ and V- inputs have high impedance and they are often able to write out the (usually memorized) equations for OP- AMP circuits with a feedback loop. Unfortunately they can’t do much more than this, and the concept of the OP-AMP rail is often not understood.

We then ask the candidate to determine the output voltage of an ideal OP-AMP with a “comparator” configuration, exemplified in Figure 2.

The voltage across R1 is 15V. The two inputs V1 and V2 are compared and the output voltage will be set by the appropriate rail supply, which in this example is the one associated with the negative input (V3).

Figure 2 - Interview question: Determine the voltage across R1.

Figure 2 – Interview question: Determine the voltage across R1.

Alternatively we also ask about the purpose of the voltage follower configuration, shown in Figure 3.

Figure 3 - Voltage follower op-amp configuration: If the voltage V1 is both at the V- and VM1, what is the purpose of this configuration?

Figure 3 – Voltage follower op-amp configuration: If the voltage V1 is both at the V- and VM1, what is the purpose of this configuration?

The voltage follower with an ideal OP-AMP gives simply V1 = VM1. However, because the high input impedance, the OP-AMP output (VM1) is isolated from the OP-AMP input (V1). In essence the current drawn from the circuitry connected to the output is not drawn from the signal source at the OP-AMP input, but from the OP-AMP rails.

Basic Embedded-C
We need our candidate to know how to program in C.There is no work around this one; the embedded systems engineer must know how to handle the most basic programming tasks.
Question #6 – The first programming question is always about distinguishing between the ‘=’ and ‘==’ operator (‘=’ is assignment, while ‘==’ is a comparator).
Question #7 – We then ask the candidate to write out the C-code that solves the commonly used fizzbuzz problem.The assignment is as follows:
“Write a program that prints the numbers from 1 to 100. But for multiples of three print “Fizz” instead of the number and for the multiples of five print “Buzz”. For numbers which are multiples of both three and five print “FizzBuzz”.”

While this is not a particularly hard, most of our candidates were unable to solve this assignment. Here is a possible solution:

We always ask something related to C-pointers. We understand that pointers can be a bit confusing to engineers, but the candidate must have at least a very general concept about what a pointer is.

Question #8 – Consider an integer k. How do you change its value through a pointer?

If the candidate shows confidence with pointers we normally ask slightly more advanced questions. For example,
Question #9 – What is the benefit of passing elements to a function by reference instead of by value? Can you write a small piece of code that demonstrates passing by reference?

Every time something is passed into a function by value, it is pushed down into the stack. If we are sending a structure with 10,000 members, all those members will be pushed down, needlessly using a lot of memory space.

Intermediate Embedded Systems topics
At this point we have a pretty good idea about the candidate and his abilities. If time allows we ask slightly more complex questions, allowing us to differentiate between the strongest candidates.

Question #10 – Consider the generic schematic on Figure 4. In this circuit, the solenoid L1 has been energized for a long time and suddenly we open the switch SW1. Can you foresee any problem? What can be done to fix it?

Figure 4 - Interview question: What might happens when we suddenly open SW1?

Figure 4 – Interview question: What might happens when we suddenly open SW1?


When the solenoid L1 has been energized for a long time, it behaves as if it were a short with current flowing from the positive terminal of the voltage source to its negative terminal. When the switch is opened, the inductor will attempt to resist the sudden drop of current. A large negative potential is created where there once was positive potential, and a positive potential is created where there was once negative potential. This large potential difference can cause the electrons to “arc” across the switch.

A flyback diode solves this arc problem by allowing the inductor to draw current from itself in a continuous loop until the energy is dissipated through losses in the wire and across the diode. This is shown in Figure 5.

Figure 5 - Correct location and orientation of a flyback diode.

Figure 5 – Correct location and orientation of a flyback diode.

Question #11 – What is the purpose of an H-Bridge? Can you draw a generic H-bridge schematic?

An H-Bridge is a circuit that allows us to control the direction of current flowing through a solenoid (e.g. a DC motor). Figure 6 shows how to control the direction of the current through L1 with the state of the switch SW1.

Figure 6 - Generic implementation of an H-Bridge using npn-transistors.

Figure 6 – Generic implementation of an H-Bridge using npn-transistors.

Question #12 – Consider the very generic circuit on Figure 7. What happens when SW1 changes states?

Whenever SW1 is open, no current will flow into the base of the Q1 npn transistor, so the bjt will be OFF. This means both inputs of the NAND gate will be pulled to ground (which is a zero binary sate). Two logic-zeros at the input of a NAND gate imply a logic-one at the output. Since the output of the NAND gate is at the same potential as V1, no current will flow through R2 and D1, which means the LED will be off.
If SW1 is closed, the Q1 bjt will be ON, and the inputs of the NAND gate will be set at logic-ones. This implies a logic-zero at the output of the NAND gate, which in turn enables current to flow through R2 and D1.

Figure 7 - Interview question: What happens to D1 whenever SW1 is pressed?

Figure 7 – Interview question: What happens to D1 whenever SW1 is pressed?

Question #13 – What is an interrupt?

An interrupt is the result of an event that tells the microprocessor to stop executing the current task, when appropriate, and execute another piece of code, called the interrupt service routine (ISR).

Question #14 – What is RS232?

RS-232 is a communication standard for a series of standards for serial binary signals. This standard defines the electrical characteristics and timing of signals, the meaning of signals, and the physical size and pin out of connectors.
* In RS-232, user data is sent as a time-series of bits.
* Both synchronous and asynchronous transmissions are supported.
* The RS-232 standard defines the voltage levels that correspond to logical one and logical zero levels for the signal: valid signals are plus or minus 3 to 15 volts; the ±3 V range near zero volts is not a valid RS-232 level.
* The devices at both ends of a RS-232 compatible cable agree on the bit transmission rate (e.g. 9600 baud, which corresponds to 9600 bits transferred per second).

Conclusion
Even with a relatively straight forward interview process, with a strong emphasis on the basics, we have had a difficult time recruiting skilled recent graduates. For those looking for a entry-level position, I strongly recommend to come prepared to the interviews. Spend a couple of days solving technical exercises straight from inexpensive books such as:

  • Schaum’s Outline of Electronic Devices and Circuits, by Cathey
  • Schaum’s Outline of Basic Electricity, by Gussow
  • Practical Electronics for Inventors, by Scherz and Monk
  • In addition keep reading and subscribing to magazines such as Elektor, Make, Circuit Cellar and, of course, Nuts And Volts.





    Sending J1939 CAN-BUS messages with Sparkfun CAN-BUS Shield

    Keeping in the spirit of open-source, I have modified the libraries of the Sparkfun CAN-BUS shield. With these updated libraries we are now able to send messages using the standard identifier (11 bits) and also send messages with the extended identifier (29 bits).

    I am running the following code in Arduino UNO. This particular CAN-BUS shield does not work with the latest Arduino board (Leonardo). Anyway, here is a simple Arduino program that continuously sends J1939 messages through the CAN network.

    The updated MCP2515 libraries can be found at http://www.nunoalves.com/source/canbus_nca26_09_2012.zip. To install this library and use it with your Arduino projects just drop it in the appropriate sub-directory (e.g. ~/Documents/Arduino/libraries in macosx). For reference here is the data sheet for the MCP2515 SPI CAN transceiver. I found all the information in there.

    Finally… a big thank you to Fabian Greif and his initial efforts on the MCP2515 library.





    Converting base-16 roman numbers to arabic numbers (and vice-versa)

    Here is neat python programming challenge.

    A hex roman numeral is very much like the standard roman numeral, except with different values. In normal roman numerals, I = 1, V = 5, X = 10 and so on. In hex roman numerals, I = 1, V = 8, X = 16, L = 128, C = 256, D = 2048 and M = 4096. So for example:

    VIIII = 8 + 1 + 1 + 1 + 1 = 12
    IX = 16 – 1 = 15
    XV = 16 + 8 = 24
    XL = 128 – 16 = 112

    The goal is to write a program in python that converts it in either direction. If given a decimal number, it should return the hex roman numeral version of the number and if given a hex roman numeral, it should return the decimal version of the number.

    I started this by creating a program that performs a normal roman to arabic conversion. This wasn’t too hard, especially since python has a ton of neat features such as as dictionaries and solid string parsing methods. Since I am using unittest to test my code, I’ve named this file roman_numerals.py.

    The package unittest provides a great way to test your programs. I love it. You can pretty much run a another script and it will perform all the necessary assertions as it tests the proper package. Here is my unittest code, which I named test_roman_numerals.py.

    Here are some screenshots of the program in action: first testing through the command line, and then testing it with unittest.

    Taking this base code and making it compatible with base-16 numerals was trivial. All that I needed to do was make a minor modification to the dictionary roman_dict and adding extra elements to the lists units, tens, hundreds and thousands. Of course I had to perform a base conversion with the hex2dec function each time I wanted to access a position in the list.
    Here is the code that converts base-16 roman numbers to arabic numbers. I saved this file as roman_numerals_base16.py.

    And here are my test cases, taken directly from the problem statement and saved as test_roman_numerals_base16.py.

    Finally, here is a screenshot of the program in action.





    Password protecting entire directories in MacOSX

    Every once in a while I have some files in a directory that need a password. I am not looking for a fancy encryption mechanism like PGP… I just want to compress the entire directory, put in a strong password and forget about it. Anyway, there are several applications that do this on the mac store… but none provide the flexibility that I was looking for. Plus, I realized this can be done in a couple of lines in the terminal.

    Lets say you have a directory tmp with a bunch of files you want to compress and password protect it. You can go the standard route using the zip utility. Just type the following:

    zip storage.zip -R tmp/* -e

    This will compress the directory tmp/ and store all the files in the storage.zip. It will also ask you for the password you would like to use. Unfortunately you cannot give the password as an argument. So, you are stuck typing the password every time you want to compress a new directory.

    There is a hack you can use to bypass the manually password submission… It involves using expect. This program is a really neat utility. It basically allows you to create interactive dialogues with your terminal programs, which makes task automation a walk in the park. You can check its manual pages here.

    Step #1: Go into the mac terminal and find out where the expect utility is located. This is done using the whereais command. Type the following on your terminal window.

    whereis expect

    In my macosx version, the program expect is located at /usr/bin/expect.
    Step #2: Create a file (e.g. protect_directory.sh) with the following lines. Make sure you modify the location of the expect program in the first line of the script.

    Step #3: Make sure your script is executable and run it.

    chmod u=+rwx protect_directory.sh
    ./protect_directory.sh file.zip tmp hello

    The first argument will be the output filename (file.zip), the second argument is the directory you wish to compress (tmp) and the last argument is the password you wish to use (hello). Neat no? Here is a screenshot of all the steps.





    Automatically leveling your Castlevania character with an Arduino

    I love playing video-games. Rarely play more than 1 hour a week these days… but when possible I put some time into old school PSone games… in particular Castlevania: Symphony of the Night. Phenomenal game! The only problem… is that there is some annoying grinding component to it.

    Anyway, on the weekends I also love spending time with my son. Unfortunately, my son is 1.3 years old which means i can’t play with both at the same time. Time to optimize! I created a very simple system that repeatedly presses the same button over an over again. When the character is in an adequate location, it will repeatedly kill any enemies that are walking in his direction.

    The point? I want to play the hard bosses and skip all the grinding. This simple contraption does the job. It is not pretty (all materials used were scavenged from here and there) but it works.

    Here are two videos showing the machine in action…

    And of course the Arduino source code… Everything was made, assembled and implemented in about 15 minutes. Automation FTW!





    Python and duck curses

    Today at lunch I realized that life would be much easier if I could check the status of my simulations in some sort of interactive menu over ssh. When I got up to my office, someone told me about Python and curses. Curses is pretty much a module that allows you to deal with terminal-independent screen-painting and keyboard-handling over text-based terminals.
    So… 10 minutes after reading this neat tutorial, and inspired by the craziness happening at 38 studios, I wrote my first game playable via ssh. You control a duck that collects worms… yes, how vapid.

    Moving a duck with Python and curses






    Choose your own adventure… in audio

    One of the things that bores me the most is driving. Ten minutes into my daily commute and I am checking out my email and reading my twitter feed. Anyway, the other day when I was coming from Boston I had this interesting idea; why not create a choose your own adventure game, which could be played while driving. Instead of reading a book, the book would be read to us by a speech synthesizer. The choices would be done by pressing buttons instead of manually flipping pages. The idea was so neat that I proceeded to create a prototype, so I could send it to a magazine, but the outcome was so bad that I pushed it aside until I find a better technology. For my failed prototype I used the linux open-source flite speech synthesizer and a beagleboard XM. As the driving engine I created a simple script in python that read a particular story and used buttons to control the flow of the adventure. The first problem is that beagleboard requires a pretty clean 5V power supply which is a mess to get in a car. Also, the beagleboard is fairly expensive ($120) to use as a dedicated game engine. Finally, creating a customized OS that is fast enough to launch the a particular application on the beagleboard is not trivial.

    Anyway, I still think that audio based interactive entertainment systems have potential, but my technical solution I chose was not the best. Most definitely I will revisit this idea soon with Android phones and tablets. Implementing this in android seems to be very easy, thanks to the IOIO connectors. For those interested, this connector is available for purchase through sparkfun. Regardless, here is a very simple code for my choose your own adventure. It is done in python and if you have a macosx it will read out the entries and choices using the built in speech synthesizer.

    The story itself (hardwired on the previous file as test_story.txt) is pretty self-explanatory.

    <1>
    You are in the top of a very tall building.
    [choices]
    - Jump <2>
    - Yell <3>
    - Do nothing <1>
    [end choices]
    <2>
    You decided to jump… thats too bad.
    [end]
    <3>
    You yell something. No one replies.
    [choices]
    - Jump <2>
    - Do nothing <1>
    [end choices]

    Finally, here is a screenshot of the program in action.

    Running the python script...

    Enjoy.





    Autonomously crawling through DICE job postings

    I am currently working on a book that requires me to search through thousands of job advertisements. For the last couple of days I have been looking at the various websites, collecting data and looking for patterns in employment listings. Even if you are not working on a book, I am sure at some point in time you will be looking for a new job online. I love searching for jobs, and if you don’t love it too… you are probably doing it wrong.
    First of all don’t manually search for jobs! It is a waste of time and it will drive you insane. Instead use a scripting language, such as PERL, that mines website databases and outlines the best matches. In fact I wrote a post a few days ago about mining employment postings on craigslist. If you are new to this entire field of data-mining, I recommend the book “mining the social web” by Russell… Nice chap…. Met him at Harvard Square a couple of years ago.



    Here I outline the steps I took to extract all job postings from DICE. First of all you have to know how everything is stored in the database. Make any random search on the initial screen (e.g. embedded).

    "Embedded" search on dice.com

    This particular search generated the following very-long URL… so long that I had to include spaces:

    http://seeker.dice.com/jobsearch/servlet/JobSearch?op=300&N=0&Hf=0&NUM_PER_PAGE=30&Ntk=JobSearchRanking&Ntx=mode+matchall &AREA_CODES=&AC_COUNTRY=1525&QUICK=1&ZIPCODE=&RADIUS=64.37376 &ZC_COUNTRY=0&COUNTRY=1525&STAT_PROV=0&METRO_AREA=33.78715899%2C-84.39164034&TRAVEL=0&TAXTERM=0&SORTSPEC=0&FRMT=0 &DAYSBACK=30&LOCATION_OPTION=2&FREE_TEXT=embedded&WHERE=

    Since this particular search detected 1689 job postings, we just have to change NUM_PER_PAGE=30 from 30 to 1689, in order to see every single job post on a single page. Save that file into your hard-disk in the HTML format. For completeness, here is the file with all 1689 postings I just downloaded. The following PERL script parses the contents of this file and looks for the associated URL for each job posting.

    Save the file (e.g. dice.pl) and execute it with the following command:

    perl dice.pl embedded_Jobs_at_Dice.html > embedded_url.txt

    This will store every single URL, one per line, in the file embedded_url.txt. Once again… for completeness, here is my generated file.

    The next step is to download every single job posting onto a separate file. Since, I am a macsox user, I need to download a the contents of each of the URLs from the web via the OS X command line. This is easy accomplished with the following bash script:

    On the same directory as the output of the previous PERL script (e.g. embedded_url.txt), save this bash scrip (e.g. download_all_jobs.sh) and execute it with the following commands:

    chmod u=+rwx download_all_jobs.sh
    ./download_all_jobs.sh embedded_url.txt

    The compressed outcome of this last step is a file of 27 MBs.

    Now that I have all this data, I need to extract the skills required for each advertised position. So, I placed all the compressed files in the sub-directory dice_jobs and ran the following script:

    The skill extraction is actually done on the following PERL script (extract_data.pl).

    I then feed the extracted data into a mathematica script; a (readable) pdf version of the Mathematica script is here, and the source is here. In this script, I combined all found skills, ignored skills that were required in less than 30 distinct advertisement (e.g. COBOL and Pascal). Below is the resulting piechart.

    Most requested skills in embedded computing jobs.

    As expected the most sought after skills in “embedded computing” jobs are C,C++ and Linux. Java, mysql and kernel development is also very strong in demand these days. Surprisingly I saw lots of mobile computing and networking skill requests. However the most surprisingly requested skills is databases (mysql)!

    Finally, I am aware that I could have done everything on this post on a single PERL script. However, writing a post about a single script would get tedious very quickly. I also wanted to save the outcome of every single step in my hard-disk so I could perform some additional data tests, without having to connect to dice.com each time.



    Start a C program when BeagleBone boots

    I’ve been spending some time lately trying to turn the BeagleBone into a “single-serving” system for my prototypes. Most of these prototypes require running some program whenever the system gets power. Before you continue, I strongly recommend you read my previous BeagleBone posts, if you start feeling a bit lost.

    So here I have a very simple circuit… 5 LEDs connected to 5 different pins (P8_3,P8_4,P8_5,P8_11,P8_12). I would like these LEDs to display a perform a simple pattern whenever the BeagleBone is turned ON. Something like the following video.

    The code for this circuit is pretty straight forward and looks like this:

    To compile and run this code, download my BeagleBone_IO library, save the above code as main.c and type the following commands:

    gcc -c BeagleBone_gpio.c
    gcc BeagleBone_gpio.o main.c -o main
    ./main

    What is neat about my code, is that it is able to trap a signal whenever the user types CONTROL+C and ends the program normally… after performing some generic BeagleBone GPIO cleanup.

    Anyway, I would like this program to run whenever my BeagleBone starts up. BeagleBone’s default OS is Angstrom Linux which uses systemd as the initialization scheduler. I am still learning about this, but according to the wikipedia entry and also to Kezhong’s Weblog, this daemon is meant to efficiently express services dependencies, by allowing more services to be launched in parallel at system startup while reducing the need to mess around with many scripts. I used to do this on ubuntu… and it was a mess.

    Anyway, I would like to declare my LED blinking program as a service. So I need to execute the following steps:

    Step #1: Create a script that will call the program that you wish you launch at boot time
    This means we need to create a file in the /usr/bin/ directory with any name. For example, assuming that our compiled LED program is in /home/root/main we can create an executable simple script called myScript.sh with the following lines of code.

    echo “#!/bin/bash” > /usr/bin/myScript.sh
    echo “/home/root/main” >> /usr/bin/myScript.sh
    chmod u+x /usr/bin/myScript.sh

    Step #2: Create the service file
    Create the file /lib/systemd/myScript.service . Actually your service name can be anything you want… not restrained to myScript.service.

    nano /lib/systemd/myScript.service

    Step #3: Write the appropriate service settings
    Your /lib/systemd/myScript.service can be for example:

    [Unit]
    Description=Run the LED pattern script
    After=syslog.target network.target

    [Service]
    Type=simple
    ExecStart=/usr/bin/myScript.sh

    [Install]
    WantedBy=multi-user.target

    Step #4: Make a symbolic link

    cd /etc/systemd/system/
    ln /lib/systemd/myScript.service myScript.service

    Step #5: Make systemd take notice of it, activate the service immediately and enable the service to be started on boot-up

    systemctl daemon-reload
    systemctl start myScript.service
    systemctl enable myScript.service

    After executing all commands on step 5, the LED program should immediately start. Try switching the BeagleBone power OFF & ON… and you will see the LED program.

    How to terminate the script that is constantly running in the background?
    If everything went okay, your script in constantly running in the background. To terminate it, you need to kill it. Use the top command and find out the process id (pid) of your looping program. As shown on the screenshot, my main pid is 13.

    Listing all jobs using the command "top".


    The following command will take care of terminating the job.
    kill 113

    How disable the script from starting up at the boot time?
    Just type:

    systemctl disable myScript.service

    Thanks to Piranha at the official BeagleBoard forum for guidance.



    Automated craigslist job search with Perl and Bash

    Most of my students are in the job market and after suggesting them websites where they could look for jobs, I took a peak at craigslist. I like craigslist; its a simple, bare-bones website with pure text. However, the search functionality is a bit awkward, and it is hard to find a good match between the candidate skills and a particular job posting. If you are seriously looking at every single “filtered” post, it may still take you over an hour to look for the best skill-to-job matches. So I created two scripts, one in Perl and the other one in Bash, that scavenge all the job postings for skill matches, and create a new webpage with all the appropriate positions and matched skills in a ready to click link. Data mining at its best!

    There are some “limitations” of these scripts. First of all they were only tested in macOSX and Linux, however I am sure you can convert them quite easily to Windows. Secondly, I’ve focused all the craigslist searches around New England. You may add other craigslist locations quite easily by following the instructions on the perl script.

    This automated job search requires two files: search_jobs.sh and craigslist.pl. Both can be found below, or at my github repository. To run the code place both files in the same directory, and edit the search_jobs.sh, shown below, with a text editor (after emacs, my second favorite text editor is TextWrangler). In this file modify the appropriate keywords that are being assigned to the variable SEARCH_SKILLS. Currently the search skills are the standard qualifications for an engineering graduate.

    This script runs with the following command line:

    chmod u=+rwx search_jobs.sh
    ./search_jobs.sh

    Running the scripts on a macosx terminal window.

    After it is done executing it will create two files engineering.html and finance.html, where the candidate can see his best job matches.

    Two html files are created with the best job matches

    Generated HTML file with the best job matches


    Below is the Perl script that parses the craigslist job postings.