13

I'm an experienced developer using variety of technologies as well as real time. I want to learn how to develop for a device which is not a computer, tablet, or any of the familiar devices everybody knows about.

I noticed that global shopping sites offer IoT hardware such as 2 channel relay module, nodeMCU development board, and more hardware related to IoT. I have no idea what to do with or get started.

Assuming that I know how to code, how do I get started developing my first IoT device?

Simon Munro
  • 1,493
  • 10
  • 13
TheUnreal
  • 255
  • 1
  • 5

4 Answers4

14

This is a very broad question, but I will try to give a few general pointers, hopefully useful to others, as well as you (so, please accept my apologies if I post things which you already know).

If you are asking about reading sensors, this is telemetry and not necessarily IoT. I have coded many projects where a standalone PC reads and displays some measurement.

If you also want to controller the attached hardware, this is SCADA. Again, it need not necessarily be connected to the internet.

Here's a diagram of SCADA, which gives a very good feel for the IoT in general. Note that the PLCs on the diagram are sensors and controls of IoT enabled devices.

SCADA architecture

You can ask for hardware commendations for sensors & controller at Hardware Recommendations.

And, once you have some code, you can get advice for problems at Stack Overflow.

Generally, IoT for industry involves the client/server model, with the client measuring/controlling hardware devices and reporting to/receiving commands from the server. The server also generally has a database, and allows for generation of reports for management and alarms (and may instruct the remote hardware to reconfigure/shutdown based on data received).

Phew! That’s the intro out of the way. Now to get our hands dirty.

If you want to get into the nitty gritty of coding, look at sockets, and understand the difference between TCP and UDP.

Fortunately, the decades have wrapped most of the trickier stuff in libraries, and you are probably best advised to read up on RESTful services. There are numerous free online tutorials, courses and videos, depending on your language; C is a traditional embedded language, with some using C++, but of course, use whatever you know/feel comfortable with. Python is hugely popular and simple to learn, as well as being the recommended language for the Raspberry Pi.

Personally, I prefer compiled languages to interpreted, as it is easier to get the bugs out, but the choice is entirely up to you. Just make sure that it has good support for accessing peripherals over USB, Ethernet and - still extremely common in industry – serial port.

For the server side, 90%+ of the world’s server are still running on PHP. However, there is an uptake on use of NodeJS, mainly from people who code browser apps, which currently can only be done in JavaScript and don’t want to learn two languages. I don’t recommend developing browser based IoT apps, because of the restrictions on browser code accessing the file system and peripherals (although, I would mention the likes of Cordova, if you want to develop for smartphone).

To get started, I would recommend a Raspberry Pi (coding in Python or C).

Raspberry Pi board

And I * highly* recommend a sensor hat. This one is just an example, but it is not expensive and contains

  • Gyroscope – angular rate sensor: +/-245/500/2000dps Accelerometer
  • Linear acceleration sensor: +/-2/4/8/16 g
  • Magnetometer - Magnetic Sensor: +/- 4/8/12/16
  • Gauss Barometer: 260 – 1260 hPa absolute range (accuracy depends on the temperature and pressure, +/- 0.1 hPa under normal conditions)
  • Temperature sensor (Temperature accurate to +/- 2 degC in the 0-65 degC range)
  • Relative Humidity sensor (accurate to +/- 4.5% in the 20-80%rH range, accurate to +/- 0.5 degC in 15-40 degC range)
  • 8x8 RGB LED matrix display
  • Small 5 button joystick

sensor board

That will allow you gather some data and report it to your server. You might be able to find a free service online to receive and display your data. I have seen some on other S.O site, but forget where.

But, you probably want to code your own server. I would recommend PHP as programming language. For Linux, you are well provided with LAMP (Linux, Apache, Mysql & PHP). For Windows, you have to install a WAMP (Windows … etc).

You can take your pick. I have used XAMPP in industrial applications for over a decade. You don’t have to use Mysql, Sqlite can serve just as well (shaless plug for my own S.O question of 6 years ago, “Sqlite or MySql? How to decide?“). You will also have to learn about CRUD.

Based on the data received from the client/sensor, you might want to send a command back, even just a simple (display : "temperature too high", which might translate to closing a valve in an industrial system).

You might want to raise alarms in real time (send email saying that the temperature is too high).

And, you might also want to think about generating reports. Start with a table showing data received. The consider a chart, or something fancier. Add an option to export to Comma Separated Values (CSV) which allows the end user to import the data into a spreadsheet for further analysis and manipulation.

If you do decide that you want fancy reporting, you can do it in PHP, but, after a few decades of that I have now moved to doing much of the report stuff client side, in the browser.

For generally principles, get an overview of Single Page Applications and AJAX. I, personally, did a lot of research and chose Google’s AngularJS as my programming language (there are lots of tutorials & great support), but you are free to use plain JS, Jquery, etc, as you please.

If you do decide to code browser stuff too, and you might be as well to use NodeJs on the server side, so that you only have to learn one new programing language.

Too many choices? Sorry :-(

I hope that this has given you some advice, but feel free to ask questions, and let me know if there is any general advice missing here.

Mawg
  • 3,147
  • 1
  • 13
  • 35
9

As an experienced developer you have the ability to understand logic, read and write code, figure things out, and some other important skills. What you probably don't have is an understanding of basic electronics and the art of getting code from your desktop running on a small device.

Jumping in at the wrong level of complexity can be daunting, and may mean that you give up too soon. For example, people recommend the ESP8266 and NodeMCU without thinking that you need to get the right one, you need the chip mounted on a development board, you have to get your software on it, you need to wire it up to something, and only then are you able to run JavaScript. That is a lot of different skills that you need, and you could give up on any one of those stages.

My recommendation is to start with an Arduino. Where Arduino made a difference in the maker community was how easy it is to plug an Arduino in a USB port, and the compile, build, deploy chain is all sorted for you. You can write some code, and flash some LEDs very quickly.

I also suggest that you start with the official Arduino starter kit. While it is very simple, the instructions are easy and you get a bunch of useful electronic bits and pieces (breadboard, jumper wires, LEDs, etc) that remain useful.

Don't be put off by how basic the Arduino is. Get some enthusiasm going first for the electronics and hands-on part before trying anything too complex. If you find the electronics interesting and want to do more, stick with the Arduino and get a more complex kit. I bought the BOE Shield-Bot robot. It may not be the best or cheapest robot, but has a really good tutorial that goes into detail on how to controls servos and such. You also land up with a whole lot more useful bits.

If you get through that, you'll either give up and get back to server-side software, or you will buy more bits, soldering irons, more boards and components. Very soon you'll land up with a drawer of broken dreams like the rest of us.

I wouldn't recommend using the Pi too soon. It's more of a computer than a thing, and doesn't have important features that are necessary in the beginning of your journey of understanding (like analogue input). You'll very quickly outgrow the Arduino (it doesn't connect to the Internet very easily), but it's a good place to see whether this will be something that you enjoy.

Simon Munro
  • 1,493
  • 10
  • 13
6

I will proceed to answer your first question.

If you want to just learn I can recommend you some books about IoT but I guess you can search them by yourself. If that is clear, then I would recommend you to start working on your own small project, that is how you learn the best, facing real-life problems.

You will need to decide what is what you want to create. Here are some inspiration and cool ideas to start off:

Arduino Projects -> Microcontroller

Raspberry Pi projects -> Microprocessor (more powerful)

hackaday.com -> Mixed components

Once you have the idea of what you want to do, then you need to come up with requirements for your project. The microcontroller, sensors, actuators, communication protocols, etc.

As you can see the most popular devices are Arduino, Raspberrypi and all the other relatives, beaglebone black, onion , etc, There are many more, the differences are the price, the compatibility with other sensors and the popularity. The popular ones are more compatible and have more support on forums.

We cam help you out with the requirement based on your project. Good luck!

Aurora0001
  • 18,520
  • 13
  • 55
  • 169
Snake Sanders
  • 961
  • 1
  • 6
  • 12
2

Others have focused on the first facet of your question; I'm going to focus on the latter. You asked if just anyone can get into IoT or if you have to be a big company with many resources.

If you browse the tag, you'll see that there are IoT devices that have all the server side done for you already. There are plenty of IoT devices that "just anyone" can buy, included would be the Nest cam, thermostat, etc., the Amazon Echo, the Google Home, smart ovens, refrigerators, etc.

Even many new cars qualify as objects to be sensed or controlled remotely... though perhaps not the controlled part just yet. :)

This leads to the answer of your first question:

How I can get started practising develop my first IoT device?

You don't necessarily have to start by developing: you can start with something simpler. If you want to get into the developing side of it, you could simply take the plunge, as some have suggested, but you do have the option available to you to start simple and move gradually into the realm of the more complex.

anonymous2
  • 4,902
  • 3
  • 22
  • 49