This video belongs to the openHPI course Wie programmiere ich meinen ersten Mini-Computer?. Do you want to see more?
An error occurred while loading the video player, or it takes a long time to initialize. You can try clearing your browser cache. Please try again later and contact the helpdesk if the problem persists.
Scroll to current position
- 00:01In today's lesson. the WLAN module of our
- 00:03Microcontrollers. To get news from your microcontroller via
- 00:09to send your Wlan, you must I'll connect you to it first.
- 00:12That's what the Connect to Wifi block is for.
- 00:16You can find it under of the "Communication" category.
- 00:19Under "WLAN name" you can enter the Names of your Wlan at home
- 00:25and under "WLAN password" the password. Make sure that
- 00:31you're going to need that two bits of information before you can start your project.
- 00:35if you're going to be Internet uses. Even if you have questions
- 00:40on the discussion forum, please remove these two
- 00:43private information.
- 00:45IFTTT stands for "If this then that". I'm sure you'll find
- 00:52the similarity to the Logic block, there stood
- 00:55on the blocks also a "if". We had there after the
- 00:58"if" always a condition in Form of a comparison and
- 01:02if that was the case, then the area is executed afterwards.
- 01:06This also works in the same way IFTTT service. At "This" you can
- 01:12you choose in the surface, What the trigger or condition
- 01:16and in "That", which is is supposed to happen. IFTT
- 01:22supports a lot of services, you can you could, for example, trigger
- 01:26by a signal from your Microcontroller at Twitter something
- 01:29post or receive a notification on your cell phone. But no
- 01:34Worry, it'll only work the services you're using your
- 01:37I'll give you the consent. For the IFTTT functionalities you have to
- 01:43register on "ifttt.com". You're giving your money for this.
- 01:47e-mail address and in the next Step you set your password.
- 01:50If you have any problems with that, it may be your browser.
- 01:54We had no deal with Chrome. Problems. After that you go on
- 01:57https://ifttt.com/my_applets and click on the upper right corner on the
- 02:02Button "New Applet".
- 02:06Our application would be now a burglar alarm:
- 02:09If at home your door or in the drawer,
- 02:13then the microcontroller shall send an e-mail to you. We
- 02:18select the THIS button,
- 02:20search for webhooks and click on them.
- 02:24The first time you do it. you then click "connect", then
- 02:30on "receive a web request" and we'll think of an event name.
- 02:38e.g. "alarm". Then click you click "Create Trigger" and
- 02:45click on the THAT button. There then you choose e-mail and
- 02:50click on connect again. Here you have to enter the mail address
- 02:54to which the messages I should have left. You will receive a
- 02:59pin as an e-mail, which you can then use as a you must enter confirmation and
- 03:04then click on "Connect". The serves as collateral so that you can
- 03:08not accidentally anyone Stranger with e-mails to spamst.
- 03:13Then select "send me to email". and click on the button
- 03:24"Create action" and then again on the "Finish" button. Now
- 03:38we have to code the event "alarm" also send. Before we
- 03:46to talk about the code.
- 03:48you add the "IFTTT" library.
- 03:51Just search for this names in the library manager and
- 03:55install the appropriate Library.
- 03:58Now to send the message to send you need another
- 04:01Connection to the Internet as on the
- 04:02Explained at the beginning of the lesson. Additional
- 04:06we use the "Setup IFTTT Webhook" block, which you can also find under
- 04:12of the category "Communications" you'll find. Here you wear as a
- 04:16API Key, what you need on the side
- 04:18"https://ifttt.com/services/maker_webhooks/settings"
- 04:25is displayed under the URL item. You are interested in
- 04:29only the back part, that is, the where we're on the slide "XYZ"
- 04:33I've written down for you. In
- 04:36loop() area you can then use the
- 04:38Insert block "trigger", where your I'm not sure if the door is open. Now you have to
- 04:42the code only on your microcontroller
- 04:44and then you can play see if you can get an e-mail
- 04:47when you're exposed to the magnetic field on your microcontroller.
- 04:51Shouldn't that be the case? then maybe you'll agree
- 04:53something to your value, so where we have 42.
- 04:57Then check again with the Serial monitor, which values
- 05:00your magnet sensor delivers.
- 05:03ThingSpeak is a Possibility to give you values that
- 05:08you with your microcontroller send, online
- 05:11in a diagram to display I don't want to. Right on the foil
- 05:15you see such a diagram, which will give you lasting values
- 05:19Soil moisture sensor of the of the plant guard. Go on
- 05:25"thingspeak.com" and click on the button "Get Started For Free".
- 05:30That's where you register, by entering your e-mail address,
- 05:35country, first and last name.
- 05:38If you have a MathWorks account you can also
- 05:43alternatively top right on Click "Sign in" and your
- 05:47Enter MathWorks data. If you're the error message "MathWorks
- 05:54Account Unavailable - Technical Issue", then it may be
- 05:59are due to your browser. We had no problems with Chrome.
- 06:03At https://thingspeak.com/channels you click on the button
- 06:08"New Channel. After that you can you your "Channel" and "Field 1"
- 06:13give a name of one's choice and click on the bottom of the page
- 06:17"Save Channel. These two Values are only used for better
- 06:21overview, but are not shown in the Code used. On the side,
- 06:27which then opens, is directly to read the "Channel ID" above.
- 06:32We need these for the code.
- 06:34There are also two lines
- 06:37under it a tab called "API Keys".
- 06:40Click on it, to find out your key.
- 06:44We need this in addition to the Channel ID.
- 06:48Before we talk about the code. the "ThingSpeak" library.
- 06:54Just search for this name in the Library Manager and
- 06:58install the appropriate Library. We are now expanding
- 07:03the code of the "plant guard", by only playing a game with one of the
- 07:07dry earth to the current value of the sensor is on the
- 07:10Show diagram on ThingSpeak I don't want to. First of all you need
- 07:15you have an Internet connection again. Add the "Wifi" block for that
- 07:19in the setup area. Afterwards you complete the part where the built-in
- 07:23LED is switched on. For this you use the "Send value to
- 07:28ThingSpeak" block and enter the Key and the channel you've been using before.
- 07:32online on the thingspeak page under your invested
- 07:35I'm sorry you couldn't find a channel. As "Field" we carry the value 1
- 07:39since we have "Field 1" online on the channel. As value.
- 07:43we transfer the current value from the soil moisture sensor,
- 07:46by using the "read analog" block there. Attention,
- 07:52ThingSpeak accepts only all 15 seconds a value for the
- 07:56free variant, therefore we add a "wait" block
- 07:59with 20 seconds afterwards. Finished are the changes you're making
- 08:03Values online in a diagram to see.
- 08:07In Ardublockly you'll also find blocks of under the "Time" category to display the current
- 08:13Time and date to I've experienced it. You can use it
- 08:17build a clock, for example, or an alarm clock in combination with
- 08:21your buzzer or the LED strip. The important thing is that you have a
- 08:27Internet connection and also the block "set time via
- 08:32wifi" in the setup area.
- 08:38That's it with the last lesson for this Course. We're hoping that you'll find a lot of new things to tell us.
- 08:42you've learned. Unfortunately in the world of computer science not everything
- 08:46error-free and especially in the Interaction with hardware can be
- 08:49it has a wide range of problems. But maybe
- 08:52ambition grabs you as it grabs us and you're having fun
- 08:56to solve problems. Remember your project and submit it on
- 09:00Peer Assessment.
To enable the transcript, please select a language in the video player settings menu.