Components and supplies
Pushbutton switch 12mm
Arduino MKR1000
LED (generic)
Resistor 10k ohm
Rotary potentiometer (generic)
Resistor 221 ohm
Breadboard (generic)
Arduino MKR IoT Bundle
Apps and platforms
Arduino Web Editor
Arduino IoT Cloud
Project description
Code
FT Debouncer Library
This library makes it easier to implement push and release actions for physical buttons, without the burden to track time, buttons states and change of state between LOW and HIGH. Create a Debounce Manager, add a pin to keep track of and let the library call two functions for when the button is pressed or released. More info on the GitHub repository, as well as in the video.
Downloadable files
Schematic
Schematic for the circuit
Schematic
Schematic
Schematic for the circuit
Schematic
Comments
Only logged in users can leave comments
Anonymous user
2 years ago
I've followed the instruction as good as possible. My code is verified. I then see the following response in the Serial Monitor: [ 8381 ] Connecting to Arduino IoT Cloud... Compile time: 1552780800 [ 11207 ] Connected to Arduino IoT Cloud After that I "GO TO IOT CLOUD" and toggle the switch. In my serial monitor I see the following results: The light is ON The light is OFF That should do it, however, I do not see the LED remains OFF What's wrong here? I just got my MKR 1010 yesterday... I still got my MKR 1010 connected to the computer using a USB cable. Is that correct?
Anonymous user
2 years ago
Hi! I have the same your problem, how did you solved it??
Anonymous user
2 years ago
Good tutorial! Small comment - resistance on the photo is 220 Omh, while the tutorial speaks about 150 Omh. The design works of course with 220 Omh, so the tutorial text could be fixed. Also LED is diode which is non-trivial for newbies like me, so it took a bit to realized while the scheme does not work (maybe small comment could be added to the text as well). Thanks again to this introduction to the arduino developements.
Anonymous user
2 years ago
Greatings to all :-) I struggle with using the example, when connecting the potentiometer and use a Delta value of 5 - this is not accepted by the compiler! it returns the text: "error: no matching function for call to'ArduinoIoTCloudClass::addPropertyReal(int&, const char [8], permissionType, const long int&, NULL, double)' - if I don' t use the delta value it works. Has anyone a solution?? Br. Franken, Denmark
Anonymous user
2 years ago
Hello, I just found out about Arduino IoT. Does it only work with Arduino MKR? I have an Arduino Uno and a GSM v2 shield. The website only allows to configure MKR versions. Is there an option to integrate my hardware with the system? Thanks, Nir
bonevalex869
2 years ago
can i use arduino nano 33 iot
Anonymous user
2 years ago
When declaring the Properties of the Thing, I think you need to choose Switch under Smart Home, rather than Boolean. Otherwise the arduino will not be discovered by Alexa when you search for device.
Anonymous user
2 years ago
mpbontenbal, Franken_Ulrik, Raymond Gordon, Adrien Sales, A_J1990, vladimirrandom my apologies for not replying to your comments/questions. For some strange reason we don't receive notifications related to this post, and a colleague made me notice this over the weekend. Do your doubts/issues still apply? A few things have been addressed over the past few months so if you still have problems let me know, I'll keep an eye on this post over the next few days. Thank you for your patience regards, Ubi de Feo
Anonymous user
2 years ago
I have just setup an Arduino 2560 for the first time. Can I use this project on the 2560 and control an on board LED ? Thank you, Bob
Anonymous user
2 years ago
hi @jakeatthelake at this moment the only boards supported by Arduino IoT Cloud are the following - MKR 1000 - MKR WiFi 1010 - MKR GSM - Nano 33 IoT Arduino IoT Cloud requires an encryption chip which is only available on those boards listed above. We're making progress on expanding the range of supported hardware and releasing more updates, but still you'll need a board which can connect to Internet in order to talk to our Cloud. Hope that helps clearing your doubts :)
Anonymous user
2 years ago
Hi all , I am .net developer and i want to connect ardunio with restfull api which has been developed in C# language. Actually i am develop home light controller and i have Ardunio , ethernet shield, puss button , Restfull api , xamarin android app, SQL database and web application. First connect the arduino with api and post and read data from sql in loop. pl help
Anonymous user
2 years ago
Thank you for publishing this project. I found it very helpful for me to get acquainted with the MKR WiFi 1010. I did, however, struggle with problems with the create.arduino.cc environment. Compiling sketches could often take a very long time to complete, and i never got the "Upload and Save" button to upload. It would change to "Busy" when i clicked it and stay that way for hours. I do not know what is wrong and have no clue how to pix it. What i ended up doing was to use that environment to add my device, configure it, and add properties. I then downloaded the code it generated to my pc and compiled and uploaded the code to the MKR WiFi 1010. I then returned to the create.arduino.cc environment and clicked the "GO TO IOT CLOUD" button and then clicked on the "Widgets" tab in order to test the code. when everything was completed and tested OK i removed the MKR WiFi 1010 from the USB port of my pc and connected it to a 5V power supply via it's USB port. I tested everything again and it worked just fine! Thanks once again for the introduction. Hope that i will soon be able to create my own projects with it. I have also purchased an Arduino Pro Gateway and a MKR WAN 1300 which i am hoping to use to learn more about LoRa projects so that i may contribute to these types of projects at work and hopefully get hired. The Pro Gateway appears to finally be configured and working now, but i do not believe that it should have been made available for sale as it is now. I just hope it is good enough for me to use to learn enough to qualify me employment. I have not begun to play with the WAN 1300 yet because i did not realize that i should have purchased an external antenna for it - something i plan to do tomorrow.
Anonymous user
2 years ago
Hi I'm just starting out on my Arduino journey. Thanks to those that have put time into developing this project! I'm unsure what I'm doing incorrect but get the message 'LED_PIN"was not declared in this scope. Appreciate any advice
alanj100
2 years ago
This is my first time using the IoT cloud and the MKR WIFI 1010. Trying to get my head around it but really confused and could really do with some help. It would really help if I could see the coding in its entirety. There are little pieces here and there so not sure what's included in it and what isn't For instance #define
Anonymous user
2 years ago
HELP! This tool is a great add to Arduino's. However - When I create a CONTACT SENSOR property - Alexa can see it and report on it, but the 'device' in Alexa App does not show up as "Smart Home" - Which means I can't use a change in state of the Contact Sensor to cause Alexa to say or do something. Motion Sensors from Amazon and even Contact Sensors on Arduino platforms connected to Samsung SmartThings hub (via ST_Anything) WILL launch routines on Alexa. Is there something else I should be doing to get this to work?
Anonymous user
2 years ago
i am not able to connect my arduino rp2040 to iot cloud pls help me
wecios
2 years ago
Hi, on the first example, can you turn the dashboard switch back to light off after 5 seconds automatically? I tried this but I did not succeed can you help me?
f-leb
2 years ago
void onLightChange() { digitalWrite(LED_PIN, ledState); Serial.print("The light is "); if (light) { Serial.println("ON"); } else { Serial.println("OFF"); } } error: 'ledState' was not declared in this scope
f-leb
2 years ago
Hi, "We simply go to Libraries from the sidebar menu, enter "FTDebouncer" in the search field at the top and press Enter: the library will appear and we can add it to our sketch pressing the INCLUDE button." It seems useless because all the libraries included in the Library Manager are already available for your sketches. A tiny little mistake : void onPinActivated(uint8_t pinNr){ Serial.println(pinNR); toggle = !toggle; } pinNr, not PinNR ;-)
Anonymous user
2 years ago
The instruction inside the blog is full of errors: "void onLedStateChange(); This line declares a function to be called every time the value of our "light" property is changed in the Dashboard" is wrong as well
Anonymous user
2 years ago
Change "ledState"to "light"
Anonymous user
2 years ago
I was looking forward to comments starting to roll in with suggestions, questions and typos. 1) Your note on Create Libraries is correct, we keep the `#include` directives for legacy reasons in case the code is transferred offline. 2) sticky fingers! going to fix that right away :) I'm really thankful for the time you're taking to comment, f-leb. Keep 'em coming and I hope this tutorial will help you get started.
Anonymous user
2 years ago
hi, Ali Taheri thank you for reporting this. we changed the name of the property/variable at the last minute and this slipped off. "full of errors" is a bit of an overstatement, though :)
Anonymous user
2 years ago
hi f-leb rectifying this right now. you'll be able to make it work in a few minutes with the corrections. Thank you for reporting :)
Anonymous user
2 years ago
We had two occurrences of "ledState" which were just replaced by "light". You should have no further issues, but please feel free to let us know if you find anything else. Sometimes one set of eyes can spot what four can't :)
Anonymous user
2 years ago
Thanks a lot for this very detailed tutorial which covers all aspects. By my side, I'm indeed stuck while trying to connect to Arduino cloud, always gettings this : ``` MQTT Broker: :0 ``` In other words, I can't finalize connection to Arduino IoT platforme. Drivers and firmwares are all OK. ``` ArduinoCloud.begin(ArduinoIoTPreferredConnection) ``` If you have any hint on this, you would be very welcome. Kind Regards, Adrien
Anonymous user
2 years ago
Thanks a lot to everyone who works on this tutorial ! It was really rewarding to do my first IOT self building with Arduino MKR1010 ! (operational in less than 1 hour ! (Light case))
Anonymous user
2 years ago
When attempting to use FTDebouncer with the library currently provided and using the directions in the tutorial, there are undefined reference errors for the functions "onPinActivated(int)" and "onPinDeactivated(int)". The solution seems to be replacing the function definitions "void onPinActivated(uint8_t pinNr)" and "void onPinDeactivated(uint8_t pinNr)" with "void onPinActivated(int pinNr)" and "void onPinDeactivated(int pinNr).
Anonymous user
2 years ago
Hi, Thanks for the tutorial. I am having issues once I've uploaded the sketch to my 1010, it doesn't connect to my WiFi. It keeps on failing and retrying, I am using the Secret tab and inputting it directly into thingProperties.h as well with no success. The WiFi SSID is a combination of uppercase, lower case, numbers and special characters.
umbertobaldi95
2 years ago
Hello! Are you sure the wifi password is correct? Maybe try with the hotspot from your phone and see what happens.
Anonymous user
2 years ago
Hello, great explanation. I wanted to know which is the refresh rate in arduino iot cloud, and the delay between sensor read and shown in the computer (iot cloud page)
umbertobaldi95
2 years ago
Hello, Thanks for your interest. The refresh rate I think it's 10 properties per second. That means you can push 10 property updates every second. Regarding the delay I think it's ~ 1 second, so it's not realtime but it's pretty fast!
davidfmackenzie
2 years ago
Great intro to using the cloud. Impressed by how smoothly it all works. Only thing I couldn't see was how to check if the device is actually connected. In the example of the LED I can toggle the state of the LED even if the board isn't powered.
umbertobaldi95
2 years ago
Hello, thank you for your interest! You should see the last update time from the Thing page :) You can change the status of the led even if the board is not connected to the internet, when the board connects, fetches the last value and should change the status of the LED automatically
sirensimo7
2 years ago
Thank you. I managed to turn led on and off with dashboard on mobilephone and pc. I have a maker plan and would like to use the API that is available for it. How can I send commands from a webpage or web app using api ? api docs is not talking anything about commanding the device from internet. If you know any place where to find info pls. tell me: sirensimo7@gmail.com . I have asked in the forum and got no answer.
e-navis
2 years ago
Hi, I actually have the same requirements as sirensimo7. I want to send commands from a website through the API for the IoT cloud. I managed to read all the data with cURL in PHP, but I can't change the value for let's say the led, from on to off and vice versa. The API docs are also not really clear on how to accomplish this. Are there plans to update, improve and/or clarify the API docs? Kind regard, e-navis
umbertobaldi95
2 years ago
Hello, thank you for your interest, you can find more info regarding Arduino IoT Cloud and API [here](https://www.arduino.cc/en/IoT/HomePage) and the documentation [here](https://www.arduino.cc/reference/en/iot/)
ismaelsapry
2 years ago
مشروع وعمل جيد جدا جدا اشكرك على فعل ذلك
Anonymous user
2 years ago
I think this is a very functional proyect, but in my case I can't turn On the led, I have the MKR WiFi 1010, I can connect it to internet, then I go to "GO TO IOT CLOUD" and I create the switch, I've linked to the led but it doesn't work. I've followed the instruction as good as possible. But it doesn't work for me :(
Anonymous user
2 years ago
I had the same issue, the problem in my case was that the yellow cable wasn't connected on the proper position of the breadboard to power the LED. Before the LED didn't turn on, however the MONITOR showed the LED IS OFF and LED IS ONN messages so my issue was with the wiring that I didnt follow correctly, make sure you're receiving these commands when playing with the widget: ----------- The light is OFF Connected to Arduino IoT Cloud The light is OFF The light is ON ----------
Anonymous user
2 years ago
I can't even get the basic one with just the LED to work. I get the code sent over but when I go to monitor, all it says is "Arduino IoT Cloud Connection Status: Connected" and then it never shows anything else and I am unable to control the LED. Help?!