Sergiy Baydachnyy

Blog about technologies

Archive for the ‘IoT’ Category

How to manage AllJoyn devices in C#: LIFX Color 1000 Example

with one comment

In the previous video we discussed, how to onboard an AllJoyn device using Visual Studio, C# and Windows 10 AllJoyn features (How to onboard AllJoyn devices in C#: LIFX Color 1000 Example).

Today, I am going to show, how we can start working with an “onboarded” AllJoyn device.

Written by Sergiy Baydachnyy

06/06/2016 at 7:06 PM

Posted in IoT, Visual Studio, Windows 10

Tagged with

How to onboard AllJoyn devices in C#: LIFX Color 1000 Example

leave a comment »

I already published some articles about AllJoyn, ZigBee/Z-Wave bridges and bulbs. You can find all my previous posts using these links:

Smart bulbs or how to be lazier (part 1)

Smart bulbs or how to be lazier (part 2)

Smart bulbs or how to be lazier (part 3): AllJoyn client

Smart bulbs or how to be lazier (part 4): IoT Hub


But today I got a chance to play with a truly AllJoyn device – LIFX Color 1000 bulb. And the first task that I had to solve is how to onboard the bulb to my local network. More information about the task you can find watching this video:

Written by Sergiy Baydachnyy

05/20/2016 at 9:29 PM

Posted in IoT, Universal Applications, Windows 10

Tagged with

The second life for my Raspberry Pi B+

leave a comment »

Finally, I can use my favorite IDE – Visual Studio in order to develop applications for Linux devices, including Raspberry Pi B+. It’s really fast and I have not to deal with Linux at all. More details in my video:

Written by Sergiy Baydachnyy

04/12/2016 at 12:25 AM

Posted in IoT

Tagged with

Internet of Things via Microcontrollers: Introduction

leave a comment »

Looks like I have enough microcontrollers and boards in order to start (once again) my training about Internet of Things. I have decided to select a non-standard approach in the training, presenting more stuff about microcontrollers rather than about Arduino/Netduino/MyDuino boards, Let’s see if you like that. I will try to publish at least one module per two weeks plus some bonus videos.

The video is here.

Written by Sergiy Baydachnyy

02/05/2016 at 11:10 PM

Posted in IoT

Tagged with

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

How to build your own drone (part 2)

leave a comment »

Last time we discussed the common parts which you need to buy in order to assemble your drone. This week I have received all parts and I will show how to assemble everything and make it ready to start.

In the first step you need to assemble your frame and place some electronic components there like ESCs, motors and power distribution board. Of course, it’s easy to assemble the frame itself but in order to place all other components you need to use soldering iron before. I would not recommend to connect ESCs directly to power distribution board. In this case you will not be able to remove drone’s legs in case of transportation. Instead of that I used XT60 connectors. So, you need to solder your ESCs and connectors and use some wires to mount connectors to power distribution board as well. Don’t forget to use shrink tubes to avoid short circuit there.

In case of motors I am using banana connectors (3.5 mm) to connect motors and ESCs because you need a way to change sequence of wires there to run motors in the right way. Additionally, you can use insulating type to mount battery. If you don’t have a 3D printer in order to print some components for your frame, insulating type might help you from time to time.


In this step I recommend to connect battery to the power distribution board in order to understand that everything is OK and everything is soldered in the right way. Use multimeter to check that all ESCs produce 5V of power through control wires.

Once you assemble your frame, you need to mount fight control board and RC transmitter. Because these boards require 5V power I used power which is generated by ESCs using control wires. But each ESC contains its own power wire, so you need to remove all power wires except one. You can use knife to do this and use insulating type in order to insulate removed wires.


In the next step you can mount flight board, RC and connect them to each other. Don’t mount propellers in this step because you need to setup you flight controller before.

In the next step you can download OpenPilot software and use wizard to setup your drone. Thanks to the wizard it’s the simplest part there.

So, in the end I spent the following amount of time for each step:

· Frame assembly – 40 mins;

· Soldering (connectors, wires, motors) – 60 mins;

· Motors, ESCs and battery placement – 40 mins;

· Flight controller and RC placement – 20 mins;

· Setup – 10 mins;

Finally, my drone is ready to fly.


Written by Sergiy Baydachnyy

06/19/2015 at 11:59 PM

Posted in IoT

Tagged with

How to build your own drone (part 1)

leave a comment »

During the Maker Faire event I demonstrated my own drone based on Netduino. And I got lots of questions about hardware but not quite as many about software. Several people even told me that they tried to assemble own drone but failed. That’s why I decided to show my experience there. I am going to have vacation this week, so, I put aside software development and new APIs for some time and have some fun trying to assemble a new drone.

I am going to develop a powerful outdoor drone. So, it should be heavy enough to fly stable despite the wind and at the same time it should have enough power to fly up as well.

Let’s start with components which you need to buy.

Pay attention that in some cases it requires some time to receive it by mail. Usually I use – if they have something you can get it in 2-3 days but it’s a little bit expensive compared to amazon and they only have a few components in each category. If I am ready to wait some time I use or – the second one has many more components and 2-3 days delivery option for some of them but you will need visit the US to get your package.

First of all you need to decide which type of drone you are going to build and select the right frame. I would recommend to start with a quadcopter but during my vacation I will build a hexacopter. It’s better to select a metal (aluminum) frame because it’s not easy to break this frame. Of course, you can build your own frame using wood or metal parts but you spend much more time and lots of money compared to exiting frames which starts from $17. I have tested two frames: X525 and 650X6. They are pretty good and not very expensive.

Once you know number of motors based on your frame you can select motors. For drone, you need to buy brushless motors which can run you propellers with different speeds. Additionally you need to buy a special control board for each motor called ESC. Thanks to ESC you can run your motors with different speed and motors have as much energy as needed. Different brushless motors require different ESC (based on voltage), so you need to read specification for motors before to buy ESCs. For the frames which I mentioned early I would recommend to buy 1000KV motors like A2212. You even can find pack of similar motors with ESC and propellers. I like this pack and usually I buy it.

Motors and ESCs is the most expensive part of the drone but the second one is battery pack. If you want to fly 20-30 minutes you need to buy a good LiPo battery and you need to buy a charger as well. I bought a 5100 mAh battery but you can buy anything from 2200 mAh. Just verify that it produces 11.1 Volts of power – it guarantees that you will have enough power for your motors and control board. Charger is usually expensive as well but you need a way to power your battery.

In order to operate your drone you need to buy radio control receiver and transmitter. I have FlySky RC but you can buy anything. In general you can fly using 4 channels only but you can use other channels for camera or something like this. Pay special attention that from time to time you can find some receivers which don’t work with common transmitters. So it’s better to buy both things together from the same company. Of course, you can use WiFi modules to operate drones from your phone or laptop but in this case your drone will not fly far away.

The most important part of your drone is the control board which sends signals to your motors, receives signal from your RC and implements some algorithms for stabilizing your drone. Usually this board contains several sensors like accelerometer and gyroscope but you can add barometer and GPS as well. For the first drone it’s enough to have just Accelerometer and gyro. I would recommend OpenPilot board because that software supports wizard which helps setup your drone, and drones based on OpenPilot are very stable. I used MultiWii boards as well but you need spend much time in order to setup those boards, and I encountered some problems with algorithms there. You can use Arduino, Netduino and even Raspberry and implement your own algorithms but it requires additional time and good math knowledge.

Finally, you need to buy some components which help to solder the frame like soldering iron, iron wires, connectors, power distribution board. Once you have all these things you are ready to start assembling your drone.

Next time I will show how to assemble my hexacopter step by step but at the end of the post I want to share list of expenses for my drone:

· Frame – $38

· Brushless motors (two packs, because I need at least 6 motors) – $146

· Power distribution board – $7

· Wires – $10

· Shrink Tubes – $3

· Banana connectors – $5

· Connectors – $8

· Battery – $38

· Charging station – $23 (probably, it’s better to buy more expensive charger in order to avoid big boom at your house)

· RC – $100

· Flight control board – $19

· Soldering iron and some stuff there – $30

So, total price of my drone is about $427 but there are still opportunities to cut down the price. For example you can buy cheaper RC, battery etc. At the same time you can increase the price adding camera, GPS, barometer etc.

Written by Sergiy Baydachnyy

06/19/2015 at 11:54 PM

Posted in IoT

Tagged with