Hackd project – Remote Car Starter

It’s HACKD season again at MeetMe! For those of you that are not familiar with the concept, hackathons are events that some companies, schools, and other organizations put together where people work on the projects they want, like new technologies, inventions, ideas, etc., that they usually doesn’t have time to spend on. I’ve had a project on the back burner for a while that I wanted to work on but, because lack of experience and knowledge (a.k.a self confidence), I never went forward with it.

MeetMe offers HACKD every couple of months and during one of the recent events, I decided to finally work on this project, which I call “Really Remote Starter”.

THE PROBLEM

About 3 years ago, I lived in Northwest Mexico, near Arizona, US. Since then I moved to the US East Coast. So I basically moved from here:

16068683

…to here:

1549573_10202914907332087_349482691_n

I found out that in this weather I need to sit in my car for a while until it gets warm. Sitting in the car does not provide an ideal comfort level. Even if you turn the heat on, it’s useless for those first few minutes.

THE IDEA

By the end of the first winter season, I desperately wanted a remote starter for my car. I thought, “it would be nice to start my car just from the warmth of my home or office and then just go to my car into a warm interior and go”. Then, when I got a remote starter for my car, I quickly realized that it wasn’t always going to be that useful.

At work, the parking lot is located at the back of the business center, and it fills pretty quickly. It can take you a good 5 to 10 minutes to walk to your car. Also, in other cases like parking at malls, movie theaters, etc. makes the Remote Starter less useful. Why? Remote starters and car alarms have RF remotes, which are very limited in terms of reach.

In my other car, in Mexico, I have a high end car alarm with a two-way RF remote that promises a one mile reach. Well it has a one mile reach in a place like this:

200013474-001

If you start adding cars, walls, and other barriers, the reach decreases dramatically. So, I came up with the idea to make my remote starter to start from wherever, without a distance restriction.

THE SOLUTION

I wanted to start my car from wherever with my cellphone, sending the car some kind of signal. I wasn’t sure exactly how to achieve this, so I did some research and looked at a bunch of Youtube videos and written tutorials. It seemed that I wasn’t the first one to try this. It seemed that everyone wanted to use bluetooth. It makes sense–your cellphone has bluetooth and you can use an arduino or a raspberry pi with a bluetooth module and voilá. But that wasn’t enough for me because that doesn’t solve my problem. Although bluetooth could have longer reach than RF, it still has that distance restriction. I wanted something that doesn’t care how far are you from your car. Then the WIFI idea came to me. “What if I put a WIFI module in the arduino or the raspberry pi?” Nope, that is not going to work either.

It should have WIFI coverage everywhere and there’s no WIFI coverage everywhere; you also have to deal with password-protected networks and stuff like that. Same happens with 3G or 4G–there’s no 100% 3G/4G coverage everywhere, and it will turn this to a very expensive solution since 3G/4G mobile plans are expensive. But, what if I send an SMS to my starter? Let’s think about it: cellular signal coverage is pretty much 100% (only remote places are deficient) and SMS can be received pretty much everywhere. Also, very basic, cheap plans can give you this advantage. Got it!

Then HACKD weekend was approaching. I researched a little bit about which board to use, there’s a bunch of options out there, not just the arduino and the raspberry pi, but settled on the arduino basically because it was the right price and the complexity level required.

HOW TO

After deciding what to use and how to use it, I got everything I thought I would need.

BOM

  • Arduino Uno Rev 3 (link)
  • GPRS Module (Geeetech SIMCOM SIM900 Quad-band GSM GPRS Shield ) (link)
  • Breadboard and Jumper wires (link)
  • Soldering Kit (link)
  • Multimeter (link)
  • Cables
  • Voltage Regulator (link)
  • Switch Relay (link)

* The breadboard, jumper wires, soldering kit and multimeter links are just for reference, you can get other model, styles, brands, etc. You also don’t need to buy anything from Amazon, you can get everything from ebay or electronics specialized stores.

* Voltage regulator. Arduino documentation says that it works with 5V to 20V, but it can became unstable under 7V and you can burn it over 12V. Common car voltage is 12V so I needed this to convert down the voltage to turn on the arduino. However after 2 or 3 days @ 5V it became unstable. I switched since then to a 9V Voltage Regulator and that solved the problem.

Well that’s pretty much everything I needed. Now the process.

PROCESS

Installing a remote starter to a modern car isn’t an easy task. There are now transponders in the keys that you have to know how to bypass, you need to know different signals for several different instruments of the car, and you also need some security restrictions, like make it so the car shuts off some time after being started without a key (you could forget it was started, for example) or make it so the car can’t be driven without a key. (A thief could take advantage of the remote starter to just jump in and drive.) Because all of that logic was already implemented on the remote starter my car already had and the hackathon was a 3 day event, I decided just to hang my stuff off the installation already there.

My plan then was that I would send an SMS from my cell to the arduino (received via the GPRS Module). Then the arduino would send a signal thru a cable to the remote starter via it’s remote control. All of this would be located on a hidden place inside the car. Here’s the diagram.

 

alarma1 (1)

So I took out the remote from it’s case and connected one cable on each pole of each button

IMG_20141008_182952 IMG-20141011-WA0009 IMG-20141011-WA0040

Then I connected one switch relay to each button on the switches I had on the COM and N.O. pins

IMG-20141011-WA0003

Then, all three switches connected to all three buttons of the remote need to connect one of their left pins to the negative of the arduino and each of the left pins on each of the three switches have to be connected to the three 5v pins that we are going to use to send the signals to it. So at the end all connected looked like this:

IMG-20141011-WA0042 IMG-20141011-WA0045

This module has to be connected to a continuous power source from the car; each car is different so anyone else trying has to figure that out. I added a voltage regulator because the reasons I already stated above.

SOFTWARE

The language Arduino basically uses is C++. Arduino has an IDE that we can use, downloadable from here. I used it for this project and it helps and works fine. Then we also need a Serial Terminal Software to communicate with the Arduino and the Geeetech SIMCOM SIM900 Quad-band GSM GPRS Shield, to send and receive SMS messages. On the Shield documentation located here, they offer some different options for different platforms, I downloaded CoolTerm for my Mac OSX from here and it worked perfectly. There’s some setup you need to do in it to communicate with the Arduino and the Shield. Ah! You also need a SIM Card with a plan installed on the Geeetech Shield.

Terminal Pre-setup

  1. Connect to the computer USB port and turn on Arduino (with the Geeetech Shield mounted).
  2. Go to CoolTerm and click options.
  3. Pick port, usually usbmodemfd something, if doesn’t appear click Re-Scan Serial Ports at the bottom.
  4. Pick 19200 Baud Rate.
  5. Ready to send and receive commands and read them.

There’s a second “language” or set of commands to learn here, and those are the ones that are used to actually send and receive the SMS messages. There’s a whole bunch of commands, not only for SMS, there’s commands to make a call, to receive it, to store, delete, refresh SMS, and all SIM card activities, even internet browsing. That reference can be located here.

Arduino Code

That code can be also viewed here and is going to be running in a neverending loop in the arduino and basically waits for the SIM card to get an SMS. Once the SMS arrives, it sends a double pulse (needed by the remote buttons) to the desired remote button, depending of the content of the SMS received. After that it deletes all the messages to avoid filling up the SIM Card.

Well, after “uploading” that to our Arduino, we can manually send SMS messages to our installation and it should work. This is a little video when I was testing it:

This is with the car already connected to the module:

I have to thank for this part of the code to my friends and coworkers Bob Dauth and Diana Shkolnikov, who helped me a lot with C++ because I had no C++ coding experience at all. After that, it was mostly done, however, I wanted an app that with a tap of a button I could tell my car to start or to open and close the door locks. I asked my also friend and coworker David Breneisen to help me with that. He came up in less than half hour with a very simple app that does the work. Here’s a screenshot:

Screenshot_2015-02-25-09-36-17Pretty much what it does is to send the SMS when you tap the button and that’s it. It also gets confirmation and shows a toast message when the SMS has been sent. Because its so many files you can find the code here. After putting that together, we finished our project.

I was able to use it all winter long and it was awesome!

Now, for this most recent HACKD, I wanted to improve on it. I projected the following changes:

  1. Remove the phone number from the code in the app and put a settings page so the user can change the phone number of the car.
  2. Get better-looking buttons with icons instead of just text.
  3. Get reporting back from the car when the car has been started, closed, or opened after the SMS is received.
  4. Add an alert to be sent by the car when a door has been opened.

This last one representing the biggest challenge because I needed to hook up more stuff to the car. I wanted to get reporting back from the car when it has started or closed or opened because there were times where my cell plan has expired and the SMS weren’t going out, I didn’t noticed that the car wasn’t started, and I was going out in the cold just to find out that the car hasn’t been started. Or vice-versa, the SMS was sent, but the car didn’t get the order, because the plan on the Arduino’s chip was expired.

For these new challenges I had to construct a new, more complex circuit represented in the following diagram:

schemeit-project

I have to thank here to my friend from México, Carlos Pinto; he is an Electronics Engineer and helped me with coming up with this circuit. A little bit of description.

1. The icons on the top left corner are switches on the doors, this switches send the signal to the car computer to let it know a door has been opened, you can see an light coming off on your dashboard when a door is open, these are the responsibles.

We need to connect those sensors to the Arduino somehow to get the signal. There’s some considerations to make — these are negative signals, and we need diodes in order to avoid the signal to go between them.

2. To the center (Doors Relay), it’s basically a signal converter. That relay basically takes the negative signal from any of the doors and sends a positive signal to a voltage regulator.

3. The signal from the Doors Relay is converted to a 12V signal so that’s why we need a voltage regulator, to convert the 12V to a 5V signal that is going to be connected to an input pin on the Arduino (we convert it to 5V because that’s what the Arduino supports).

The rest of the circuit is pretty much the same as it was, just the connection from the car to power up the Arduino and the switches needed for sending the signals to the remote control of the starter. Then we need to update our code for the Arduino as follows:

This code is also on my Github and I have to thank Drew Denardo also friend and coworker for helping me with this code and putting together the new version of the Android app that now looks like this:

Screenshot_2015-04-22-17-56-40 Screenshot_2015-04-22-17-56-55

The code for this version can be also viewed here. After presenting and wrapping up the new version of the remote starter in the HACKD event, I realized an issue on the way it is programmed now; it sends me an SMS when a door has been opened or closed, even when I open or close the door. Obviously I don’t need an SMS telling me a door has been opened/closed if I’m the one doing it. I need to add some kind of logic to tell it when it is me doing or not. But I guess that’s going to be for the next HACKD?

Quick Tip: How to install or uninstall APKs on multiple Android devices with just one command

Recently, while working on a mobile project, I found myself spending a lot of time connecting a device, uninstalling the previous version of the Application Under Test (AUT), installing the new one, and then disconnecting the device, just to do it again on another 6 or 7 devices (I would like to talk about why it is better to test on actual devices than in a simulator, but that topic deserves its own blog post).

For this post, I want to describe a solution I found to manage all of the attached devices with a single command. First I obtained this device, (you can get it thru Amazon here)which is just one of many different options available, depending on the arrangement, number of ports, shape, etc. I picked this one because it was cheap and the switches come in handy because we can exclude devices just by switching OFF that specific device and there’s no need to connect/disconnect any device.

usb hub

Just adding ports to your computer helps, but we need to get the most of them. When working with Android devices and we want, for example, to install an app, we have to type the following command in the terminal:

 This works fine when you have a single device attached because adb is designed for a single device, but when you have multiple devices attached, you get an error,  like so:

 We need to specify to adb the device we want to send the command to. To do so, we need to first get the device ID of every device connected by typing:

This command will return something like:

 Then to install on each device, we would need to copy each of these ids, and include them in the following command.

If I were to do this, I would need to copy each deviceID, type the above command seven times, pasting a different deviceID each time. Although this is better than connecting and disconnecting each device, this is still not the most productive way.

Searching the web for a solution, I found on Stackoverflow a script that solves this problem nicely.

Installation

First, copy and paste the following code in a new file called adb+

Then store this new file in the folder containing adb within your Android SDK installation folder. This should most likely be the  platform-tools folder.

Usage

Using the script is very simple. When we have more than one device connected (always use adb devices first, just to make sure all your devices are connected) we just need to work as if we were using adb, with any “adb” command replaced with “adb+”. For example, if we want to install an app:

This gives us something like:

Troubleshooting

If you find that you get the following when you attempt to run adb+

Your bash script simply isn’t executable. This is very easy to fix, run this command from the directory containing the script:

Now try it, you should see what you were expecting.

That’s it. The new script will go thru each device, performing the same command.  The app will install on all devices connected, and you will save a few minutes. What do you think? Is this going to help you with your mobile testing? Let us know!

The Best Browser Add-Ons for Quality Assurance

Recently, Firefox 29 was rolled out with a new redesign and, while downloading and installing it, I realized all the history Firefox and I have together. I believe the first version I installed was 2.7; since then we’ve been BFFs.

I’ve seen some browsers rise, grow, and die, like Flock (based on Firefox) and Rockmelt (based on Chrome). I have also seen others that always have been there, like Opera and Internet Explorer, but they have never been good enough.

As a Quality Assurance Tester, Chrome became a necessity to test because of its dominance in the market and, while I have grown accustomed to it, I still prefer Firefox.We testers need tools to help replicate user errors on the websites we’re testing, but the browsers alone are not enough for in-depth needs. This is when we can get help from some add-ons that can extend our browsers’ capabilities.

Below are some of the add-ons I use frequently and that all testers should utilize. This list is mostly focused on Firefox, but most of these add-ons (or similar ones) are also available for Chrome.

Fireshot

One of the most common tasks of a tester is taking screenshots. We need to take screenshots to back up our findings and sometimes we need to show the error to the developer. There are many of apps for this task, but my favorite is Fireshot. It has two killer features.

First, it is capable of taking screenshots of a complete page, even when the page is not showing completely in the browser. The second is the ability to add annotations within the app with some other great tools in it. These are important to us as testers because we can point out to our dev/design teams, stuff that is out of place, or bigger/smaller that it should, we can annotate steps to follow in the current page, to replicate some issue, etc. That helps or dev team to visualize what we are reporting and helps them realize faster where in the code that could be fixed.

fireshot screenshot

Another interesting feature is that once we install it in Firefox, it will prompt for installing it on Chrome and Internet Explorer. Unfortunately, this add-on is not available on Mac for any browser, but there are some other pretty good options for this OS. I’ve been using uploadscreenshot.com for my Firefox on Mac, and although is not as complete as Fireshot, it has been working pretty well for me. It can also take screenshots of a complete page, even when the page is not displaying completely on the browser. Fireshot is available for Free and there’s a PRO (paid) version for about $40  for a Lifetime License.

Firebug

This is an add-on that has been around for a while with Firefox. Although now all browsers have their own debugger tools, I still consider this one a must-have. I keep liking it because I’m used to it, and its interface, in my opinion, is more friendly. If we compare it to Chrome’s native tool for example, Firebug is easier to use because everything is one or maybe two clicks away, in Chrome’s native tool there’s some cases we have to navigate through some three-like menus to get some kind of info., like cookies.

Firebug Screenshot

By using it we can edit the cookies, delete any specific cookie to replicate certain behavior, we can navigate through the HTML code of the current website and its CSS, we can even modify it and see the changes on the fly, for example, to fix some little CSS issue, we can give a suggestion on how to fix it, or actually find the part of the code that is causing the problem and that will save some time to our dev to fix the problem. We can also see errors from the console, copy and paste the response of a call and report back to our dev with that information, that would help them debug the issue and a lot of more stuff. This is, if not the most, one of the most important tools for a Tester. It is also expandable, we can install addons on it like Yslow or Firepath (more on this one later).

Every web tester should know how to use Firebug or any of the native alternatives for all the browsers. Firebug is available for Firefox in Mac and Windows and it is also available in a pretty light version for Safari in Mac.

Measure It

Lets say that we want to make sure that the measures of that textbox or that other button meet the requirements described in the specs. We could use Firebug to search through the CSS of the application. However, sometimes the code is not that clean or we can have problems finding an specific item. Measure It is a pretty good tool for this situation. This add-on adds a button into our browser that when clicked will let us draw an area and tell us the measurements on pixels of it. Easy and quick.

MeasureIt Screenshot

It is currently available for free in Firefox and Chrome, in both Mac and Windows.

ABP

AdBlock Plus is a tool that can be very useful if we are not currently working with ads testing or our app doesn’t need them to work. This add-on blocks all the ads from a website based on specific filters we choose. With this add-on, our app can work faster because it doesn’t load them, bringing better performance to our app and less distraction to us.

ABP Screenshot

However, we have to be careful with this add-on as it can hide some bugs that our users are experiencing. For example, when an ad is broken, it can cause a bug in our app and we won’t be aware of it if we have this add-on active. Or, worse, it can cause us a momentary panic if it inadvertently shows us a bug that is not happening when the ads are present in our app. When the layout of an app depends on the ads, if the ads are not present, the layout might break. I’ve always find it useful to get my Application Under Test (AUT) better performance for my tests. This add-on is available for free in Firefox and Chrome for both Mac and Windows.

Link Evaluator

As its name implies, this add-on evaluates all the links in a given page and it colors them green, yellow, or red depending on their response. It colors them green when it receives a 200 or 400 response, and red if it gets a 404, 500, or some other error response. It is very useful to check all the links in a page quickly and to avoid missing any of them. In this way, the tester doesn’t need to click on each one to see if there are any dead ends or some other bad user experience.

Link Evaluator Meetme

It is available for free in Firefox on Mac or Windows, and, although it is not available for Chrome, there are other options for this one. The most similar is Link Checker that is available for free on Mac and Windows.

Dummy Lipsum

This add-on helps us by generating dummy text. Suppose we want to fill a form or see how some text looks in a page. After installing this add-on, we would have a button on our browser’s toolbar that, on click, will bring us a dialog where we can pick between some options, like how much paragraphs or words, if we want to include punctuation or html tags, etc.

Dummy Lipsum Screenshot

After selecting all our options, we just need to click Generate button, then Copy to Clipboard button and then we can paste it anywhere.

This add-on is available for free only for Firefox on Mac and Windows. There are similar tools available there for Chrome or any other browser, like YALIG (Yet Another Lorem Ipsum Generator) that is available for free in Chrome in both Mac and Windows. There are other fun Lorem Ipsum Generators that are not add-ons, but are useful and will add a touch of creativity to our tests. We can add them to our bookmarks for easy access.

  • Fillerama generates dialogs from shows like Futurama, Dexter, Arrested Development and more.
  • Pirate Ipsum  generates random pirate like sentences.
  • Obama Ipsum generates random President Obama quotes.
  • Trollen Ipsum generates trolling phrases between, for example,  Apple Fans to Android Fans and viceversa.
  • Quote Ipsum generates random famous quotes.
  • Picksum Ipsum generates phrases from movie dialogs from characters of Michael Caine, Jim Carrey, Clint Eastwood and Morgan Freeman.

Web Developer

This tool adds a menu to our browser with a whole world of options that can help us to make our day-to-day work a little bit easier. What I’ve used it for is the cookies menu, which lets us clear cookies completely. Sounds like nothing special, right?. Where this is useful and different is that it lets us clear just the cookies from our current session or just current domain cookies. This is a major help for when we have login credentials for various sites and we want to clear cookies for just one of them. With this tool we can also play with the CSS, disabling it, changing it, adding stylesheets to the current page.

Web Developer Screenshot

We can also disable the cache, disable cookies, disable javascript. All that can help us to test certain conditions in an application. It can help us to work with Forms, clearing all fields, with just one click, auto-filling forms, etc. It can also work with images, for example it can display image sizes, disable all images, display alt texts and tons of other features. This one is a must have!

This add-on is available for free in Firefox, Internet Explorer, Chrome, and Opera for Windows and Firefox and Chrome in  Mac OSX.

URL to QR code

Not talking about a specific add-on here, there’s a bunch of them out there for all browsers and OS combinations. What does they do? Very simple, they generate a QR Code using the URL for the current viewing web page. Something like:

When we use a mobile device like a phone or a tablet and we scan this QR Code, it will open the browser in the device and navigate to that URL. In that way, we can easily type our URL in our desktop browser, then take a picture with the device with a QR Code reader. In this way, we would not need to type in those tricky small touchscreen keyboards. This saves some time and hassle from typing if we are working on a browser-based mobile app or website.

URLToQRCode Screenshot

I have tried URLtoQRcode on my Firefox + Mac environment. On my Chrome in both, Mac and Windows I have QR Image from URL. But in my Firefox + Windows I use Etao QR Code, all them are practically the same thing and all they are free.

iMacros

The first automation tool in this post, iMacros allows us to record steps that we are doing manually and while recording it saves those steps as code. Once recorded, we can edit, add, or remove steps on it’s own IDE. And finally we can play them over and over again. While not the most popular app available for this, I find it as good or better than Selenium, the most popular tool out there.

iMacros Screenshot

iMacros has its own versions free for Firefox, Chrome, and Internet Explorer in both Mac and Windows. In that way, we can create our script in Chrome and play it there, but also in Firefox and Internet Explorer.

There are a few caveats preventing it from being perfect. This free add-on has some command restrictions on its Chrome and IE versions, compared with its Firefox free version. And the Firefox free version has some other restrictions that the PRO version doesn’t have. The PRO version is more complete, allowing us to use their own browser, and code scripts in almost all well-known programming languages. However, it is very expensive. For the frugal-minded, the Firefox version is pretty capable–we can build pretty complex scripts there.

Selenium IDE

Who hasn’t used or heard about this tool? It’s free, compatible with all major browsers and OS (including Linux), and programming languages. What else we can ask for, right?

Selenium IDE Screenshot

This IDE is pretty much the same thing as iMacros, letting us record steps made manually and play them back later. All steps are recorded in Selenesse, the Selenium language. This tool has other add-ons that let us export our scripts to other languages as python, ruby, php, java, etc. It also has its own add-ons created by the community that further expand the capabilities of this IDE.

Firepath

Last but not least, now that we are talking about automation, I would like to talk about Firepath. Who hasn’t had problems with the way Selenium’s playback functions from time to time? Firepath is an add-on for Firebug. It lets us select an element from the web page we are on and it will tell us its Xpath or CSS selector. It also works backwards–we can specify an Xpath or CSS selector in the box and it will mark for us the element that meets that selector. We can then use that information in our scripts.

FirePath Screenshot

So, what do you think about these tools? Do you like them? Are you already using any of them? Which ones have I missed? Give us a shout and let us know!