# Converting Thingspeak Arduino Code to WebThings

**URL:** <https://discourse.mozilla.org/t/converting-thingspeak-arduino-code-to-webthings/100537>\
**Category:** WebThings\
**Tags:** learning\
**Created:** [July 18, 2022, 6:17pm UTC](https://discourse.mozilla.org/t/converting-thingspeak-arduino-code-to-webthings/100537 "2022-07-18T18:17:50Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ryaniot](https://avatars.discourse-cdn.com/v4/letter/r/c67d28/32.png) [@ryaniot](https://discourse.mozilla.org/u/ryaniot)\
**Post date:** [July 18, 2022, 6:17pm UTC](https://discourse.mozilla.org/t/converting-thingspeak-arduino-code-to-webthings/100537/1 "2022-07-18T18:17:51Z")

</div>

hi there! I recently came into having this aquaponic sensor kit thanks to someone getting rid of their system, and found the arduino code from the manufacturer here:  
[https://github.com/Atlas-Scientific/Ezo\_I2c\_lib/blob/master/Examples/IOT\_kits/aquaponics\_kit/aquaponics\_kit.ino](https://github.com/Atlas-Scientific/Ezo_I2c_lib/blob/master/Examples/IOT_kits/aquaponics_kit/aquaponics_kit.ino)

I was wondering about the possibility of converting this adafruit huzzah32 code to broadcast webthings. From a first glance it doesn’t seem too different from how i got my esp8266’s working, but i was wondering if anyone could double check how i plan to go about this. It seems like i’d grab the outputs mapped to the “ezo board device list”, and map each output with a thing device and thing property along these lines (thanks for the arduino examples):

```
Ezo_board device_list[] = {"MultiLevelSensor", nullptr};
ThingDevice dissolvedOxygenSensor("DO", "Analog Dissolved Oxygen Sensor", sensorTypes);
ThingProperty DO("DO", "dissolved oxygen in parts per million", NUMBER, "LevelProperty");
DO.unit = "ppm";

```

I suppose I could also use the http addon to GET the thingspeak values if all else fails, but honestly I’d rather purely support webthings software and share this with other aquaponic farmers using similar sensors to keep that open source train rolling! Does this seem like a good way to go about it? Any other advice for someone doing something similar? I haven’t touched arduinos since 2020 and i think im a little rusty. Thanks for everything and keep on keeping on!

---

<div class="post-metadata">

**Author:** ![Martin\_Verret](https://avatars.discourse-cdn.com/v4/letter/m/e56c9b/32.png) [@Martin\_Verret](https://discourse.mozilla.org/u/Martin_Verret)\
**Post date:** [July 18, 2022, 6:30pm UTC](https://discourse.mozilla.org/t/converting-thingspeak-arduino-code-to-webthings/100537/2 "2022-07-18T18:30:11Z")

</div>

Hello, @ryaniot, this sound like a nice idea to do it open source!

first i have no experience at all with arduino.

but what i could get ,it’s that your arduino device connect to wifi and then you could access data with wifi.

if so you maybe could take a look at how the webthings staff handle wifi devices with the tp-link adapter.

> **[GitHub - WebThingsIO/tplink-adapter: TP-Link Kasa smart plug/bulb adapter for WebThings...](https://github.com/WebThingsIO/tplink-adapter)**
>
> TP-Link Kasa smart plug/bulb adapter for WebThings Gateway

if i would like to create something like that, i probably start by analyzing a code that have similar purpose, and try to create my own plugin based on this one.

If you have any question, and if i could help in any way feel free to ask!!

---

<div class="post-metadata">

**Author:** ![ryaniot](https://avatars.discourse-cdn.com/v4/letter/r/c67d28/32.png) [@ryaniot](https://discourse.mozilla.org/u/ryaniot)\
**Post date:** [July 19, 2022, 6:16pm UTC](https://discourse.mozilla.org/t/converting-thingspeak-arduino-code-to-webthings/100537/3 "2022-07-19T18:16:28Z")

</div>

thanks @Martin_Verret! I actually built that guess from webthing’s arduino example. I’m definitely using tp link plugs via the addon as my outputs. That part is working really well thanks to the rules feature! It’s really great how much work folks have put into webthings

---

<div class="post-metadata">

**Author:** ![Martin\_Verret](https://avatars.discourse-cdn.com/v4/letter/m/e56c9b/32.png) [@Martin\_Verret](https://discourse.mozilla.org/u/Martin_Verret)\
**Post date:** [July 19, 2022, 6:20pm UTC](https://discourse.mozilla.org/t/converting-thingspeak-arduino-code-to-webthings/100537/4 "2022-07-19T18:20:37Z")

</div>

it will still be going on if community is behind this nice project!!
