Controlling an infrared helicopter with Arduino

So I’ve gone ahead and bought myself an infrared controlled helicopter in a local shop. At the time of writing, it’s Christmas so it’s kind of like a present I’ve got for myself. If you live in Belgium or the Netherlands, I’m talking about Action :-).

It looks like this and it retails for about € 15. However, buyer beware: I’m no expert but it flies like absolute *****. It does not really hover and despite my best efforts to calibrate it, it keeps on rotating.

On the bright side it uses infrared for it’s remote control. Since I’ve been teaching my students in one of my classes about infrared I’ve gotten up to speed on the basics. I was confident I could spoof the remote control commands with an IR LED and an Arduino. Turns out I was right.

Note: if your thinking about autonomous flight using this particular helicopter… move on to another model because in my opinion, it’s not really possible unless the helicopter can stabilize itself and remain in position. This helicopter simply can’t do that.

If you want to simply do a proof of concept then by all means, read on.

What you’ll need

  • An IR RC helicopter from Action
  • An Arduino (I’ve got a Leonardo)
  • An IR LED (38 kHz) and 220 Ohm resistor
  • A breadboard
  • Optional: an IR receiver

Deciphering the protocol

This step is optional and I’ve basically done all the work here. By using an IR receiver I’ve reverse engineered the commands sent by the real remote control. I’ve done this by using the IRLIB2’s rawRecv sample code, pressing buttons on the remote control and then looking at the data. This was a process that required some patience.

I’ve discovered that, per ‘command’, 36 ‘timing values’ are sent to the helicopter but only four of them are unique:

  • Approximately 1900
  • Approximately 315
  • Approximately 950
  • 1000

An intercepted ‘command’ looks, for example, like this:

1902 330
306 334 310 330 286 354 310 330
310 962 950 962
310 966 946 962
310 330
310 330 946 966 946 966
310 326 310 334
942 334 946 330
310 1000

Each value at approximately 315, we interpret as a ‘0’ and each value at approximately 950 we interpret as a 1. The values in red are regarded as a header and trailer and do not count as meaningful data.

The translated ‘command’ then looks like this:

1902 0
0 0 0 0 0 0 0 0
0 1 1 1
0 1 1 1
0 0
0 0 1 1 1 1
0 0 0 0
1 0 1 0
0 1000

The first 8 bits represent the throttle value. 00000000 is of course: 0 and 01111111 is the maximum at 127.

The next 4 bits represent the left / right value where 0111 is idle, 0000 is left and 1111 is right.

The next 4 bits represent the forward/backward value where 0111 is idle, 0000 is forward and 1111 is backward.

The next 2 bits represent the channel. 00 is A, 01 is B and 11 is C

The following bits contain calibration information but I have not really bothered with that. I’ve always left it at it’s defaults: 001111 0000

The last 4 bits is the checksum and this was a tough one for me to find. It’s basically the data grouped in pairs of 4 bits and then you XOR them together. The result is XOR’ed again with 0101.

So it’s like this:

0 0 0 0
0 0 0 0
0 1 1 1
0 1 1 1
0 0 0 0
1 1 1 1
0 0 0 0
0 1 0 1
 1 0 1 0

Now we have everything we need to spoof commands to the helicopter :-).

The schematics

Basically this is an Arduino with an IR LED and resistor. You connect an IR LED just the same as a normal LED.

The only caveat is that you should wire the LED to pin 9 on a Leonardo as this is different from the UNO.

The code

I’ve written a lot of comments in the code so it should be fairly self explanatory. Upload to the Arduino and you’re ready for takeoff.

 

Magento 2 Create a Configurable product using SOAP API

Uploading a Simple product in Magento is pretty easy and straightforward. Creating a configurable product is a little bit more difficult.

In this post you’ll see C# code on how to create a configurable product in Magento 2 using the SOAP API. There’s not a lot of sources on the internet for this and it took me a while to figure this out.

This is how it works:

  • Create and upload the simple products (and don’t forget their SKU’s)
  • Create and upload the configurable product (specify the attribute that’s changing and don’t forget it’s SKU)
  • Link the simple products to the configurable product

Now let’s get started.

Create and upload the simple products

Create and upload the configurable product

You’ll see I make a call to my own method GetProductAttributesByAttributeSetAsync. Basically it’s used to know the attributes of the attributeSet the product is in. I have made my own attributes like color_config or size_config. If an attributeSet has an attribute with _config in the name it registers this as productOption. These are the options that will have a dropdown in your product page.

You need to configure product options in your configurable product

Link the simple products to the conifgurable product

 

Peugeot 208: activation of the Redline theme in DiagBox

I love my Peugeot 208 1.2 VTI 110 hp with the Allure trim in a cool Orange power color. But the thing that annoys me is that I only have one theme available in the SMEG software (the on board display console).

Warning: i did not yet succeed in activating the Redline theme but this is my progress (and I think I’m close). If anyone has tips on getting the DiagBox software to authenticate without using the internet, please let me know. Thank you.

It looks like this:

But I want it to look like this:

This is called the ‘Redline’ theme and to my knowledge it’s only available if you have a GT Line or GTI trim.

I saw some posts on a few forums: http://www.peugeotforums.com/forums/308-2014-122/smeg-configuration-201618/ and http://www.forum-peugeot.com/Forum/forum-peugeot/Electronique-embarquee/smeg-plus/themes-smeg-sujet_38732_1.htm .

The second one is in French but it basically says that a guy succeeded in doing so with the help of a Peugeot mechanic. To do this, the mechanic used DiagBox but the steps he or she has taken are not very clear. It is believed that every console has every theme on board and they are enabled or disabled according to the trim. The car recognizes the trim by the VIN number.

So, I ordered myself a DiagBox kit on AliExpress for € 45 and a few weeks later received it in the mail. Time to start tinkering…

My setup is as follows:

  • Virtual Windows XP 32 bit machine (using Virtual Box) running on a Windows 10 64 bit host.
    – Don’t enable the firewall or install an Antivirus on the virtual XP machine as this will interfere with DiagBox.

    – You can never let the virtual XP machine connect to the internet! So make a manual TCP/IP configuration and leave the default gateway blank. That way you can still have shared folders between guest and host machine.

  • I didn’t go through with the installation of the DiagBox software supplied in the AliExpress kit as my antivirus (Norton) says it’s full of malware. I found a torrent version online that doesn’t have that problem and installed it instead.
  • Connect the Lexia cable to your computer, it shouldn’t have any problems finding drivers. In Virtual Box’s USB settings, enable the USB 1.0 option and add a USB filter for the cable. Mine has the name PSA.
    – Note: if you have Wireshark installed on the host machine, consider uninstalling the USBpcap software (and reboot) as this was giving me errors when trying to use the cable. The device was always busy or already claimed.

Once you’re done with this , it’s time to get in your car and find the OBD2 port:

This picture is obviously not my car, this is a GTI but the OBD2 port is located in the same place no matter what trim. I even read somewhere it legally has to be in the near vicinity of the steering wheel… You’ll need to remove the plastic cover to access it, start from the left side and bottom and pull.

The OBD port looks like this:

And off course you’ll have to connect the Lexia cable to this port.

For this to work the engine has to be running with ECO mode switched off so make sure you’re not low on fuel. Also you don’t want to do this in your garage because of the fumes.

  • Start DiagBox, choose Peugeot and select 208. It will initiate the communication and if all goes well it will show you the car’s VIN.
  • Go to repair

  • Go to the Telematic unit (RTx) or audio-navigation and click the V in the right hand corner to start the communication with this ECU.

  • Make sure the engine is running and you have disabled ECO mode (only if you have a Start & Stop engine, there is a button on the left side of the steering wheel).

  • Now go to repair

  • Click configuration

  • Yes yes, we know it already… Engine on and ECO mode off… If you’re in your garage, get out and do this in the open air so you don’t breathe in the fumes.

  • Click Manual configuration

 

Now, first I want to show you that you can view (but not change) the theme’s that are active.

  • Click view and print all configuration parameters

  • Click the Personalization menu configuration option

  • Scrolling down, you clearly see all themes mine has theme 15 active and theme 8 (Redline) deactivated.

Unfortunately, you can’t change this here as it is read only. It’s my belief that if you could access ‘Configuration with displaying of the parameters’ without the error that you have to be connected to Peugeot you can activate the theme… This seems like a DiagBox bug…

So, this is going to be continued.

Migrating email from hotmail / outlook / live to Outlook 365

Migrating your e-mail from an old Hotmail, Outlook or Live account to a new Outlook 365 account should be easy since it’s Microsoft talking to Microsoft.

Unfortunately for me, the back-end import service was down so I had to do a PST import. I’ve jotted down the steps in case someone is on the same struggle bus like I was for a while.

Part 1: Saving your Hotmail / Outlook / Live account to a .pst file
  • Connect your Outlook desktop client to your Hotmail / Outlook or Live account and let it synchronize.

After synchronization, you’ll get an .ost file but if you payed attention you would have noted that you needed a .pst file. You’ll have to convert .ost to .pst. On the Internet, you’ll find many (paying) .ost to .pst converters but if you have access to the account, that’s really not necessary.

Just follow these steps:

  • In Outlook 2016 go to File and click Open. Yes: apparently to export you need to click open…
  • Now click Import / Export.
  • Select Export to a file and click next.
  • Choose Outlook file (.pst) and click next.
  • Select your account and make sure the subfolders checkbox is ticked. Click next.
  • Note the location where you have saved the file (probably backup.pst) and click next.
  • Make sure this file is in a folder all by it’s own. No other files may be present! Move or copy if you have to.
Part 2: upload the .pst file to Microsoft

At Microsoft, they’ve made an excellent tutorial about this. At first sight it looks very daunting but trust me, follow the steps and you’ll get there. It’s not that hard as it seems.

Please follow the steps in: https://support.office.com/nl-nl/article/Use-network-upload-to-import-PST-files-to-Office-365-103f940c-0468-4e1a-b527-cc8ad13a5ea6

After everything is in place and you’ve started the upload you’ll probably get this error: The client could not finish the operation within specified timeout..

That’s because the AzCopy tool thinks that whatever you’re trying to upload takes less than 17 minutes. If you’re like me, you’ll have an ADSL or cable connection that isn’t fast enough to get the upload there in time. Just add /NC:1 to the end of your AzCopy command . Retry the command, ignore the journal warning and you’re good to go.

Part 3: adding security roles

I have an Office 365 Business Essentials package. There is only one user: the account manager. However, this user does not have sufficient rights to import e-mail. You’ll need to explicitly add this role and you can read all about it here: https://technet.microsoft.com/library/jj657480(v=exchg.150).aspx

Goto your Exchange Management center. You can find this in your Office 365 admin center on the left bottom of the page. Or you can try and click this link: https://outlook.office365.com/ecp/?rfr=Admin_o365&exsvurl=1&mkt=nl-BE&Realm= If the link doesn’t work, you need to add your realm. That’s most probably your domain.

  • Go to Permissions, Admin roles and select the Organization Management Role. Click the edit (pencil) icon.
  • In Roles, click the + icon and add the Mailbox Import Export role
  • In Users, click the + icon and add your user
  • Don’t forget to save.
Part 4: starting the import job

Now you’re really ready to start the import job. Follow the steps in https://support.office.com/nl-nl/article/Use-network-upload-to-import-PST-files-to-Office-365-103f940c-0468-4e1a-b527-cc8ad13a5ea6#step5 and you’re ready.

Good luck!

Removing the H1 title from a category in Magento 2

The huge H1 title personally annoyed me in the Magento 2 categories so I decided to remove it. Turns out it’s pretty easy.

Go to your category and click Design. Insert this code:

Clear the cache and refresh.

Solving Bannerslider Class Magestore\BannerSlider\Ui\Component\Listing\Column\Image does not exist

So we wanted to have a Banner Slider on our Magento 2 frontpage and Magestore provides one for free. After installing using their tutorial on GitHub I wanted to configure the banners.

It soon became clear that this was not going to be an in install and go type of application.

If you click Content -> Manage Banners you’ll get this exception: Class Magestore\BannerSlider\Ui\Component\Listing\Column\Image does not exist

This is triggered by some sloppy coding that has uppercase BannerSlider mixed up with lowercase Bannerslider. So to solve it you would need to replace all occurrences of BannerSlider to Bannerslider.

This is pretty easy on linux. All you need to do is this:

  • Login to your system using SSH
  • Navigate to this folder:

  • Issue this command:

  • Check if everything has been replaced:

  • Clear the cache and everything should be working.

Disable the H1 title in Magento 2 on the Homepage

Disabling the H1 title in Magento 2 is a fairly simple process. You first need to override the Magento blank or luma theme and navigate to this folder:

Of course you’ll need to replace <vendor> and <theme> with your own values. Inside the folder you need to create or edit the file cms_index_index.xml.

The content of the file should be:

Flush the cache, reload the page and voila.

Acer TravelMate 7730 Windows 10 WiFi

I recently updated an Acer TravelMate 7730 from Windows Vista to Windows 10.

After the update I noticed the WiFi button was not working and there was no network available. When troubleshooting the adapter, Windows stated that ‘The device cannot find enough  free resources that it can use. You need to disable one of the other devices on the system.’.

In Device Manager (start, run -> devmgmt.msc) I disabled the PCMCIA adapter and everything worked great. Who knew that actually doing what the exception stated could solve the problem :-).

Magento 2 disable product compare

If you’re going to override the Magento theme then I really would advise against modifying  the Magento core files. A better practice is to create your own theme and override all the files you need. This way you can update Magento with much less worries. How you create your own theme is for another episode.

Supposing you have created your own theme you should have a directory structure that looks something like this:

In my case, the theme is called desktop.

In the desktop folder, create a directory called Magento_Catalog.

And in the Magento_Catalog folder, create another directory called layout.

Now, with nano, create a file called default.xml

In the default.xml file, insert:

Clear the cache and you’re done.