Intro: Using Helium's Virtual Atoms
Helium is a complete wireless platform for the internet of things, supplying integrated hardware, software interfacing, and infrastructure to easily, efficiently and securely connect objects to the internet. If you don't have hardware you can still interact with the Helium Network subscribing to our virtual Atoms, leveraging one of our SDKs (Ruby, Node, C). This tutorial builds on the SDK subscription walkthroughs, showing you how to use them to interact with the virtual Atoms. All MAC addresses and corresponding Tokens are functional, so feel free to use them yourself!
Other helpful Helium resources include:
Step 1: Repeating Virtual Atom
Each virtual Atom is programmed to have one simple function. The first is the Repeating Atom, which simply takes the last message sent to it and repeats it back every 1 second.
To use a Repeating Atom all you have to do is subscribe to it and add a few lines of code to send it some info. Make sure the data you are sending is packaged with msgpack. This is shown below in Ruby:
msg = pp.to_msgpack conn.write(0x000000fffff00009, token, msg)
Complete ruby code for send data to a repeating virtual atom can be found here.
Step 2: Echoing Virtual Atom
The Echoing Atom receives whatever message was sent to it and returns it one time.
The Echo Atom can be used the same was as the repeating atom. Remember, you will only get your data returned once, so it may be good to send more data, such as below:
(0..1000).each do |i|<br>pp = i msg = pp.to_msgpack conn.write(0x000000fffff00004, token, msg) sleep(1) end
Complete ruby code for send data to an Echoing Virtual Atom can be found here.
Step 3: HTTP Virtual Atom
The HTTP Virtual Atom has you send messages through the Helium Network by accessing
In order to interact with the HTTP Virtual Atoms all you have to do is subscribe to them. When you do that you should see any message send over the network arriving to your terminal. Sending data requires 3 terminals, including the one subscribing to the Atom.
Terminal 1: Subscribes to the Atom.
Terminal 2: Runs interactive Ruby, encodes your message to base 64 and packs it via messagepack.
$ irb > require 'msgpack' > require 'base64' > Base64.strict_encode64(["Your Message Here"].to_msgpack) => "kbFZb3VyIE1lc3NhZ2UgSGVyZQ=="
That final line is your returned message. Copy everything between the quotations.
Terminal 3: Sends the message over the Helium Network. Take what you've copied and insert it after 'body=
$ curl -X PUT -d 'body=kbFZb3VyIE1lc3NhZ2UgSGVyZQ==' john.helium.io:3001/000000fffff0000d
Your message should show up in terminal 1, along with the messages sent by anyone else to this MAC.