If you plan to submit a PR bigger than a simple change in one file, here is a short intro about how to do a clean PR. Using generic libraries from external sources for sensors should be avoided as far as possible as they usually include code for other platforms and are not always written in an optimized way.
The generally accepted way to use this would be to detect your sensor and once this is done set a sensor value accordingly so that the function does not use unnecessary resources during future calls, for example:. When writing your function responsible for detecting an externally connected I 2 C device try to create a method by which you read or write to specific registers that would be applicable to that specific I 2 C device only as to confirm a positive detect for the device.
If this is not done extensively it will lead to some drivers getting false detects for a different device type simply because it shares the same I 2 C address. This is of course only applicable to drivers that are not enabled by default in any of the pre-built binaries.
An example is the DS18B20 driver where readings conversions they call it can take up to mS from the initial request. This is currently not being used actively as some users complain about disappearing sensors for whatever reason - Could be hardware related but easier to make Tasmota a little more flexible.
The 94 given in this example should be different for every sensor driver to make sure not all sensors start detection at the same time.
Using the drivers index number should be a good starting point. NOTE: This callback ID is deprecated as sensors should prepare for more regular updates due to "realtime" rule execution. This callback ID is called to allow a sensor to prepare for saving configuration changes. To be used to save volatile data just before a restart. This function adds a log message to the local logging system dumping the serial buffer as hex information, e. Functions with a S read signed data types while functions without a S read unsigned data types.
Functions with LE read little-endian byte order while functions without LE read machine byte order. These functions return 1, 2 or 3 bytes from the I 2 C address addr and register reg. Functions with LE read little endian byte order while functions without LE read machine byte order.
These functions return true after successfully writing 1, 2 or size bytes to the I 2 C address addr and register reg. Flash code is limited to k but keep in mind that to allow OTA upgrade, you need Flash memory to contain two firmwares at the same time.
To go beyond k, you typically use tasmota-minimal as an intermediate firmware.
Memory is even more limited: 80k. With Arduino Core and basic Tasmota, there are 25kk left of heap space. Heap memory is very precious, running out of memory will generally cause a crash. ESP is based on Xtensa instruction set. Xtensa is a 32 bits RISC processor core, containing 16 x 32 bits registers. ESP supports integer operations, including 32x32 multiplication.
It does not contain an FPU for floating point operations, nor integer divisions.
Contrary to classical RISC processors, all instructions are 24 bits wide instead of 32 bits. To increase code compactness, some instructions have a 16 bits version used whenever possible by gcc. If you want to see what assembly is generated by gcc, in file platform. Below is the generated assembly. As you can see, this is the simplest function we can think of. Register A2 holds the first argument and is used for return value.
A3 holds the second argument. In the first loop, the register a4 needs to be converted from 32 bits to 8 bits in each iteration. The linker removes any unused functions, so we need to limit the number of floating point function calls.They provide a variety of wireless products for controlling and monitoring solutions, which are suitable to build an Internet of Things IoT POC without having to spend hundreds of dollars. Trust me! The most important thing we have to do before starting any integration is understanding the architecture behind it.
Basically the RF devices send a flag every time a device changes its status. Once the data is received in Node-RED, you will be able to manipulate it as you need it, as well to connect it with third party services such as IoT platforms like Ubidotssocial media services, voice assistants, or any service that comes to your mind that could allow you to communicate over an API. Remove the black covers for the 4 screws from the bottom side of the bridge.
Then, remove the screws using the proper screwdriver. Remove the top carefully in order to take out the main PCB. Once you take it apart, you should have the following result:. To be able to connect the adapter to the bridge, you must solder a few male headers in the pins as seen here:.
A second option is not to solder the pins, and use male jumper wires and hold them with your finger during the uploading process. Press the reset button on the bridge, and while pressing the button, connect the USB serial adapter to your computer. In case you don't have it, click here to download it. Click here to download the bin file. In the " Advance " tab, make sure the settings match the following configurations:. With the firmware successfully uploaded, move the switch to ON and assemble the bridge.
Connect the bridge to any power supply. At this point, the bridge will create an AP access point. Scan the available networks in your computer and establish the WiFi connection with the one called " sonoff-xxx ". At this point you will be redirected to a WiFi setup page.
Enter the SSID and password of the desired network you want to establish the connection with and click save. After establishing the connection, use a network scanner app to know the new IP address that has been assigned to the RF bridge. As one of the final configuration, you have to set the module to be used, in this case the RF Bridge.
For testing purposes, you can run Node-RED locally on your computer. Then, assign the following configurations:. If don't have it already installed, click here. In my case, the host assigned was With a background in Electrical Engineering, she is constantly learning, sharing, and experimenting with the latest IoT technologies out there.
IoT Ambassador Ubidots. Previous Post. September 15, Next Post.Pages: . Max and SPI problems. I'm trying to combine a few libraries I have to save space, and do a little optimizing in the process with direct port access instead of digitalReads, etc The library provided for the Max works, but it doesn't use the SPI library at all, so to start with, I'm trying to just do the bare bones Write to the registers, and read back from them The hardware side works fine, but using this code I'm only getting 0xFF back when I read from any register Here's the code Code: [Select].
Code: [Select]. Re: Max and SPI problems. One blunder found. I never called the "InitializePins" function so all the CS pins were low. What did it fix? Have you tried single-byte transfers where you'll need to set the CS pin high between each byte transferred?
What's your SPI clock rate? Thanks for the ideas Whenever I use SPI. I just tried setting the CS high between each register. Here's a simple loopback test you can do.
Very strange results, and the results changed if I put a delay between registers, which leads me to believe there is a timing problem. Theres a serious lack of documentation for the SPI library. I'll try that. OK, dlloyd, that works just fine So back to the drawing board, i've fiddled and fiddled, it's been 4 hours of it now and I'm nowhere. I get data, and it's approximately right, but not quite. I'm bugeyed and burnt out!Make the Sonoff smart power controller even more awesome by installing the Tasmota open source firmware.
Tasmota adds many new features, and allows you to integrate Sonoffs into an existing home automation system without relying on external cloud services. You can make the connections using jumper wires and the instructions in my previous video, or you can use my handy little programming adapter. Both methods do exactly the same thing: my programming adapter just makes it neat and easy.
Connecting your computer to a Sonoff while it is connected to mains is extremely dangerous. Details of the electrical connection are shown in the previous episode, so check that out if you need more information. The Tasmota firmware and its documentation is available at github.
The binary releases are at:. The binaries fall into several categories which are outlined on the releases page. That way if I come back to it later, I can see what version I downloaded.
Esptool is a utility that can be used to read and write the flash memory on devices using the ESP and ESP microcontrollers, including all current Sonoff models. You can download esptool from github. The exact location of the virtual serial port will vary depending on the type of converter that you have, what operating system you use, and which physical USB port you plug the converter into. Then release GPIO0.
This process is explained in detail in the previous video. If you want to make a backup of the original firmware so you can restore it back to factory-original later, jump to the addendum near the bottom and then return here. Otherwise, carry on! Open a terminal, and go into the directory where you have the Tasmota binary. Use esptool to push it to the Sonoff using the serial port location that you found earlier:.
While esptool is doing the upload it will report useful information about the hardware in your Sonoff, including the MAC address. You can copy and paste the MAC address out of the terminal and save it in a document or spreadsheet for future reference if you want to. Disconnect the Sonoff power power, then reconnect it. On your computer or smartphone, go into WiFi settings and look for a network with a name similar to this. Make a note of the network name, because you will need it in a moment!
Your computer should then automatically open a captive portal, with a WiFi configuration screen for the Sonoff. Enter the WiFi settings for your normal network into the Sonoff. This will cause your computer to drop off the temporary WiFi network that was created by the Sonoff, and reconnect to your normal network.Saturday, January 13, That was cool.
Let's try something a bit "easier" - a NodeMCU module, which is easy to connect and upload to, in conjunction with a new sensor, the SHT30 that does humidity and temperature over an I2C interface.
ESP Easy: How to add OLED SSD1306 display to an IoT ESP8266 project
This is prompted by this articlewhich doesn't really say how to do any of this Obligatory not very illustrative pic - bits are labelled pretty much! Oh yeah, had to solder the header pins onto the SHT30 - piece of cake now :-p. Compiled the latest Tasmota code using the ESP 2. And that was probably a bit rash! I'm hoping the code uses mDNS, because that's really handy. Hmm, that didn't seem to work - using the Serial Monitor indicates it's still using the old values OK, Saved the file, try again Retry in 10 sec.
I connected ok, but then it seems to crash. Quick recompile Actually, looking at the code, I just have to use "server", not "server. Now it works. Should also be advertising itself. I have no idea what the difference is if it's not actually a Sonoff!!
The sensor was actually detected on the final restart and the software immediately started sending MQTT messages with its readings. Here's a listing of the console printout after the final boot and recognition of the sensor, with "gpios" and "modules" commands thrown in for good measure:.
Post a Comment. I have a hankering to measure the input and output temperatures of my condensing boiler, in order to determine if it's likely to be actually condensing at any time. However, running 2 separate rigs, one each for input and output, means that temperature measurements will not be synchronised, which doesn't account for the action of the boiler and its heat output rate of change. So I started out by modifying one to use a different bus from the standard one - this is easily done by bridging a link with solder.
I then used 2 NodeMCUs running together to check that the newly addressed device is actually detected and works. It does. So, let's see what we can do, eh? Read more. Monday, January 01, I used a Twilio test account to send SMS messages triggered by the front door bellbut of course that is about to expire, probably because I've flogged it to death with a piss-taking number of SMSs owing to connecting one of the security cameras at the rear of the house to it If you knew the number of packages we have delivered, you'd know this is infeasible!
Besides, all the services have different APIs, and I couldn't be arsed to sing up for another trial somewhere else. What to do? WhatsApp announced that they aren't going to have an API, so that's out. I played around with iMessage, but that's pretty closed too. There are smartphone apps available that will receive a message and use the phone's text connection to send an SMS, but they also require using an API to contact the ph…. Sonoff Web Main Menu with Sensor readings displayed.Add a view on an Arduino project or ESP requires still a bit of work.
For a Arduino project, start read this post. In this tutorial, we will achieve a small barometer that measures the pressure using a BMP sensor and the temperature and humidity using a DHT For it go to the Tools page and then click on I2C Scan. You should get something like this:. It is located at address 0 x There is for the OLED display to help him.
SONOFF RF Bridge (433MHz) Hack using Tasmota
If you also want to recover the moisture level, opt for a BME The advantage of the BME is an easier integration in Domoticz. There is to indicate the content for each line. Another very interesting function is the possibility to order or view the text using a simple HTTP request. We could for example retrieve weather on an online service and display it on the screen from a home automation, a Mode-Red script server…. Hello Foad.This RGB light strip controller surprised me - Drew's Reviews
Line 1 that I get the value displayed? Hello Olaf. There is no solution I should look for ready made. It can be done with a little arduino code easily. You must already get the data from thingspeak.
Hello, thanks for your help, but that was not what I espected. Thank you for your visit and info. Have a good day. Hello and thank you for the tutorial. Participate in the development by downloading the test version from the Apple Store or the Google Play Store. You are already over ! Thank you! To learn more about infomaniak's commitments to the environment. Buy this item Banggood.A peripheral must have correctly wired power, GND and data pins to the device prior to booting in order for Tasmota to detect it and initialize it properly.
Tasmota allows for easy selection of peripherals and assignment to GPIO pins. First select desired module for the device Wait for the restart. GPIOs All shows list of all available components by name and index. For a peripheral to show up you may need to power cycle your device instead of a soft restart.
Read more Temperature units can be set to Celsius or Fahrenheit with SetOption8 command. Pressure units can be set to hPa or mmHg with SetOption24 command. Default interval is seconds but can be set between 10 and seconds.
TelePeriod 10 will set the update interval to 10 seconds, so the sensor will update 6 times a minute. Some peripherals offer, or even require, additional commands.
See Sensor commands page for peripheral specific commands. To make a link between the different naming schemes the Pin Definition overview in the ESP wiki is quite helpful. You can set this through the module config page as option Switch1 9 or from the command line with gpio14 9. If you can avoid it, don't use GPIOs: 0, 1, 2,15 and That leaves 4, 5, 12, 13, 14 as GPIOs without any constraints. Others can be used but you have to mind the constraints outlined in this document.
The ESP is a 3. The pins are not 5V tolerant, applying more than 3. Many devices on the market have barely adequate power supplies for normal operation. Voltage regulation issues typically result in fatal exception fault code 1. You must ensure that the device receives sufficient power current and appropriate voltage level. Take into account the current that each wired component f. When you switch a GPIO pin to an input and hang a long wire off of it, that wire can pick up stray signals and cause the voltage on the GPIO pin to vary.
This can cause the system to think the switch has changed. A pull-up resistor is a resistor connected between the GPIO pin and 3. The exact value of this is not critical, 4. This ensures that when the switch it open, the GPIO pin will go high.
This provides a path for any radio signals that are picked up by the wire to go to ground and not confuse the system. Shielding or using twisted pair wiring are other ways to reduce the effect of radio signals on the system.
Example for 10K Resistor issue As the name implies, they can be used as digital inputs to read a digital voltage, or as digital outputs to output either 0V sink current or 3. Do not use any of the reserved pins. If you do, you might crash your program.