Sergiy Baydachnyy

Blog about technologies

Posts Tagged ‘IoT; Windows 10

Arduino shield for Raspberry Pi 2 or How to solve problems with PWM, analog input and not burn down the apartment with a soldering iron

with one comment

I have already published some posts where I told about Raspberry, Arduino and other boards as about boards for your own prototypes. Using these boards you can easily create something before you invite real engineers, who will make a custom board for you based on your needs. And it’s clear that all existing boards have some limitations because it’s simply not possible to create something universal that can satisfy everybody (something small, Windows 10 powered, with 60 analog pins, WiFi on board and what will not require much power). That’s why you can find lots of different micro boards on the market and Microsoft published general requirement for supported hardware but doesn’t focus on specific boards. So, once you make a prototype using available hardware you may start to think about a board which implements all needed features.

But previous paragraph doesn’t answer the question: how to create a prototype using Windows 10 IoT Core and using available boards on the market such as Raspberry Pi 2 if I still cannot use PWM, Analog signals and even some type of digital signals (pulseIn implementation)? The short answer is: keep calm and think about different boards as just a different type of brain.

I am not so strong in biology but I like to catch crabs. If you cook a crab, try to find the brain inside. Frankly speaking, I am not sure if it’s there but according to rumors in Internet it exists. In any case, if somebody asks me to implement a crab, I think that I will use just several capacitors, sensors and the simplest transistors but I will not use any CPUs at all. It’s a simple binary shifter: move all type while food sensor send low signal and change the direction if too much light (light sensor is sending low signal) is available (just go deeper). In Ukraine I keep some hamsters. I am sure that they have brain and I think that ATMega 328P-PU (Arduino Uno chip) will work fine for hamster implementation. In case of dogs it’s better to have something more advanced, faster and with ability to run some scenarios in background – I think that ARM Cortex A7 CPU should be good for this task.

So, select the brain you need. Pay special attention that the same things can have different types of brain due to different number of features. For example, I have a dream to build a drone that will able to find and destroy other drones. Of course, I need a way to use OpenCV, to implement lots of different algorithms etc. In my case, ARM Cortex A7 is must. But if you want to implement a simple RC drone and use CPU just for stabilization algorithm – ATMega will work much better.

Ok. You decided to use Cortex A7 CPU and found Raspberry PI 2 on the market which supports Windows 10 IoT Core. Thanks to Windows 10 I can develop my software very quickly using well known APIs and tools (like Visual Studio). Let’s imagine that you want to build the same drone which will intercept other drones. Of course, it’s easy to use camera, OpenCV and other technologies but stabilization algorithms should be there as well. You need a way to use PWM in order to power brushless motors, read digital signals from RC controller (like manual pilot system etc.). So, we just returned to the initial question: where is PWM…?

Raspberry Pi 2 doesn’t support software PWM. Of course, you can emulate it using software but quality of this emulation will be low and I think that the drone will be self-destructed during the first flight. But I still don’t understand why you don’t ask me about other features which are not available for Raspberry: where is embedded gyroscope? where is embedded WiFi? Where is embedded toaster?

Usually, if you need some sensors you simply buy and attach them to the board. Using I2C, SPI, Serial, you can communicate with all external stuff and implement that you need. So, if you need PWM or analog input, simply attach it.

BTW: By accident I found a Raspberry shield for copters. It’s expensive but it existsSmile

I made some research and even published the post about analog input for Raspberry but finally I decided that the best solution for PWM, Analog and digital inputs is Arduino. It was adopted by huge number of developers and it’s easy to find how to implement you code which should work with particular external sensors, shields etc. Of course, Raspberry PI and Arduino board have different form factors and Arduino board cannot be stacked on Raspberry, so I decided to build my own Arduino from scratch and build it like a shield for Raspberry.

Visiting which is physically located in Vancouver Island I bought the following things:

· Raspberry Proto Strip Board

· Stacking Header

· ATMega 328P-PU with bootloader (you can buy it without bootloader but you need another Arduino to flash bootloader there)

· 16Mhz crystal

· Some 22 pF capacitors, 0.1uF capacitors and one 10uF capacitor

Additionally, you need to make sure that you have different resistors (at least 10 kOhm and 220 Ohm) at least one led, a button and Serial to USB converter. In case of a converter you need to make sure that it has DTR pin (not just RX and TX) because I have a converter which has CTS pins, so I bought a new oneL

Finally, I spent around 20 Canadian dollars for components. I believe that I could have bought all this things for 10-15 dollars but I am not ready to wait a month for a package from China. In case of BC Robotics I got all these things in 48 hours.

On the next step you need to find a schema how to build own Arduino from scratch. I used this one: I decided to use Protected Shrimp but I simply removed the button from the circuit in order to save some space.

Just one advice there: assemble everything using a breadboard because Raspberry Proto Strip Board has similar architecture. Once you have tested your circuit it’s possible to move all components to the strip board one by one.

In 30 minutes I got this:


Now you can use USB to Serial in order to apply all needed software to your Arduino. It depends on the method you select to make a connection between Arduino and Raspberry. For example, you can use StandardFirmata sketch, which is installed with Arduino SDK and you can use I2C or Serial communications.

In case of my drone, probably, I will create my own software for Arduino because I want to implement all stabilization algorithms there and I have another important tasks for Raspberry. Because I discovered some problems with serial pins on Raspberry + Windows 10 (you still can use USB to Serial converter but….) I decided to connect Raspberry and Arduino I2C pins using simple wires. Once I select the right communication protocol I will use soldering iron to fix connection between Raspberry and Arduino.

Finally, I have ordered one more Strip Board to make one more shield with all needed sensors which will be connected to Arduino. And right after that I may forget about hardware and pay all my attention to software where I will use C#, Universal Windows Platform and Visual Studio – all things that I like!

In summary I want to emphasize two things:

· There are no problems with specific hardware features – just do it!

· If I decide to create a commercial version of my drone, I will hire some engineers and ask them to make my own board which will be ready for Windows 10 IoT core and will contain all needed sensors.


Written by Sergiy Baydachnyy

08/03/2015 at 4:20 AM

Posted in IoT, Windows 10

Tagged with

Microsoft Canada at Vancouver Mini Maker Faire

leave a comment »

Last weekend I got a chance to participate in Vancouver Mini Maker Faire event. I still don’t understand why it’s called “Mini” because the exhibition filled all the space at PNE Forum including outdoor exposition. And, of course, we had our own booth there as well. So, what was Microsoft doing there?


Half of our exposition demonstrated ability of Visual Studio to support IoT projects for different boards like Arduino, Netduino, Raspberry Pi 2 etc. I have developed two rovers based on EZ-B controller and based on Arduino. In case of EZ-Robot I used UniversalBot project for developing Windows 10 applications. For Arduino I used the instructions which you can find on but you can use Visual Studio to develop and deploy Arduino applications directly using Visual Micro plug-in. Additionally I have developed the drone based on Netduino board, so I used .NET Micro Framework and C# to develop all stabilization algorithms there.


The second part of our exposition was around Kinect and 3D printing. Thanks to 3D printing support in Windows you can develop your own applications very quickly without thinking about how to cut the model in slices or generate G-code. Additionally, you can use existing 3D printing software like 3D Builder to create own models and print it.


Additionally, 3D Builder supports Kinect devices to 3D scan of existing objects.

Of course, we used Kinect not just for 3D scanning but for entertainment as well. All attendees have a chance to dance in our Xbox One area where we used Kinect as well and installed Just Dance Kinect ready game.

I hope that everybody had some fun visiting out booth as well as all other expositions there.

Written by Sergiy Baydachnyy

06/19/2015 at 11:51 PM

Posted in IoT

Tagged with

Raspberry Pi 2 and Windows 10: My first experience

leave a comment »

Finally, Microsoft published Windows 10 preview build for Raspberry Pi 2 (and not just for Raspberry). So, if you have Raspberry, you can visit and download the build and setup instructions.

Of course, it’s easy to prepare an SD card and put it to Raspberry but pay special attention that:

· You need to use microSD card class 10. I missed this requirement and was very upset when found that my Raspberry is not even trying to start. When I checked manual once again I checked my SD and found that it has class 4! So, I changed it and everything started working fine;

· First start requires much time to finish all things. So, you need to be patient;

· You need to connect your board to network using network cable. It’s a preview and many famous WiFi adapters don’t work on Raspberry right now. So, if your application connects to Internet you will need to use network cable all the time but if you want to create a simple LED project you need access to network at least for deploying your project;

If everything is ok you will see Raspberry image and important information like device name and IP address on the screen. So, your device is ready and it’s time to establish connection between your PC and Raspberry. In order to do it you can visit the following page to setup connection using PowerShell. I tried to make it several times and discovered some issues on my PC. Because I am not admin it was very hard to understand what happened there, so I want to share all stoppers I had:

· Set-Item issue – when I ran this command I got an exception with complicated message about private and public networks and some advice to change network from Public to Private. When I checked my network settings (Network and Sharing Center) I found that my network is Private but I have Virtual Ethernet Adapter which was created by Visual Studio installation. I simply disabled it and the exception was gone;

· Enter-PsSession – when I ran this command I got one more exception “The WinRM client cannot process the request. If the authentication scheme is different from Kerberos…” Once I got it I spent much time to understand how to setup WinRM but my knowledge in this area is not enough, so I selected the simplest way: I ran Gpedit.msc and navigated to Local Computer Policy->Computer Configuration->Administrative Templates->Windows Components->Windows Remote Management->WinRM Client. There I enabled Allow unencrypted traffic and Trusted Hosts and, additionally, I enabled all hosts there. And the problem was gone. I hope that you can find a way to configure it in a better way but I simply didn’t have much time to check all combinations because I wanted to start development!;


Once you connect to your Raspberry you can change password, device name, run some configuration cmdlets etc. Pay special attention that Raspberry supports two modes: headed and headless (with GUI and without GUI). You can read more about the modes here.

Right after you establish connection between your PC and Raspberry you can try to develop something. Thanks to Visual Studio it’s very easy to develop, deploy and debug solutions on Raspberry. Raspberry runs Remote Debuger by default so you should not make any additional configuration.

In order to start you need to select the language. You can select between Node.js, Python and standard languages for Universal applications like C#. Of course, I decided to use C# but you can easily install Python or Node.js tools from Connect site. So, in order to start you need to create a simple Universal application, change platform to ARM and select Remote Machine for deploying and debugging.


Finally I develop and deploy my first application for Raspberry:


Written by Sergiy Baydachnyy

05/04/2015 at 8:38 AM