Getting Started (4): Loading Device Software Via LuaLoader
If you’ve finished the Getting Started: Setup ESP8266 Dev Board tutorial, then your dev board now speaks Lua and its ready to start communicating with the world. Now it just needs specific instructions or programs to be useful for your specific device use case. Lucky for you, I’ve already written the software necessary to get your sensor up and running. Just visit our Downloads page and download SimpleIOThings.zip.
Unpack the .zip file, and then find it. Open “SensorSetup.bat” and it will open a Command Terminal Window. It might look scary, but you only have to input some simple text in response to some questions.
Go through the prompts. Ignore the parts about flashing your dev board (we already did that) and enter your IFTTT Maker Key, the Maker Event name, the device’s location info, etc. It will also ask you how many sensor inputs you’d like before an event is triggered. Depending on your use case, you may want to set your threshold lower or higher. There are suggested recommended values for a Button, Smoke Alarm Notifier, and a Fridge Door Alert. Use the values recommended for each device, or use your best judgement and fill in the values on your own. When you’ve completed the setup questions, the terminal window will create or edit your software files (.lua files), and then automatically close.
Now open LuaLoader.exe as an administrator and click “Upload File…” on the right side menu. Find your unpacked folder and click on any .lua file and click “Open.” Your first .lua program file will upload into the dev board. Now that you’ve set the right directory, click the dropdown menu and click “< Upload all .lua files.” Now ALL of your .lua program files will upload into your dev board.
One last thing. Before we hit restart, setup your wifi network name and password. To do that, enter the wifi network name and password for the network the device will use and click “Set AP.”
Now click “Restart!” If everything went well, you should see “Listening for Sensor Inputs…”
Awesome. That means your ESP8266 dev board is connected to your wifi network and fully programmed. Once this is done, you can build your specific IoT device based on the project you’re working on.
Tom September 30, 2017 - 9:34 pm
Is it possible to build this project without using IFTTT?
If I want the button to send an email through a dedicated server, what do I need to do?
SimpleIOThings October 9, 2017 - 4:07 am
It is possible, but you would need to develop or use an API to receive the POST request or use another protocol type to send and receive messages. Coding would definitely be doable but there’d be a significant amount of setup between the infrastructure to receive requests and editing current code to send them. Let me know if you end up building it!
Yecarrillo October 18, 2017 - 2:17 am
To set WIFI SSID and pass you should use now (methods presented here is depecated and trigger an error)
wifi.sta.config {ssid=”your_ssid”, pwd=”your_password”}
SimpleIOThings October 18, 2017 - 3:16 am
Sometimes the setwifi.lua doesn’t play nice with every router. I recommend setting your ssid and password via Lualoader.