Microsoft is building an online Raspberry Pi simulator that allows users to write code to control hardware.

Raspberry Pi ... in less than two minutes Watch Now

If you want to build your own gadgets using the Raspberry Pi but don't have the kit or even a Pi, there could soon be another way to get started.

Microsoft is building an online Raspberry Pi simulator that allows users to write code to control emulated hardware, and that currently lets users interact with an LED and collect data from a sensor.

The simulator shows a graphic of a Pi wired to a combined humidity, temperature, pressure sensor and a red LED via a breadboard, a plug board that allows circuits to be wired together rapidly. Users can type in a side panel to enter Node.js JavaScript code, which can be used to control the LED and collect dummy data from the simulated sensor. That code can be executed using a command line at the base of the panel.

SEE: An $89 Raspberry Pi rival that runs full Windows 10 and Android

The simulator loads with a sample program for collecting the 'temperature' from the sensor and displaying it in the command line. Microsoft has a tutorial for how to run this code, which requires users to sign in to Microsoft's Azure IoT Hub and select the free tier service option. The sample application is fully compatible with being run on a real Pi, and the simulator seems to be designed to allow people to test code for controlling hardware using the Pi, before transferring it to a real device.

At present, the simulator is in 'preview' and is quite rudimentary, which means the embedded image of the Pi is static and the simulator is limited to interacting with the sensor and the LED. However, Microsoft is planning to emulate new devices and sensors, according to Xin Shi, a Microsoft employee based in Shanghai.

While he says there is currently no timeline for Microsoft expanding the simulator, he adds that others are free to do so, as the simulator's code is open-source.

Image: Microsoft

Microsoft are not the first to simulate Pi-controlled hardware, the Raspberry Pi Foundation worked with US startup Trinket to create a web-based emulator for Sense HAT, an add-on board that is bundled with various sensors, a joystick and an LED matrix that the Pi can interact with.

Similar to the Microsoft simulator, the Sense HAT emulator allows users to write Python code to interact with the add-on board, however, the emulator gives users a greater range of sensors to interact with, as well control over a simulated version of the board's LED matrix.

The Raspberry Pi has been hugely successful since its 2012 launch as a low-cost board aimed at helping teach kids to code, with more than 14 million Pi boards sold.

Open Source Weekly Newsletter You don't want to miss our tips, tutorials, and commentary on the Linux OS and open source applications. Delivered Tuesdays Sign up today

Read more about the Raspberry Pi