Neues Projekt Hilfe?
  • Projekte
  • Zeitraum
  • Badge
Neueste Kommentare
Gustavo Murta
Gustavo Murta vor 2 Stunden
ESP32 DVM7135 - Blynk IOT tests - Youtube Video
ESP32 Digital Voltmeter
Gustavo Murta
Gustavo Murta vor 2 Stunden
Today I did some tests with my DVM ESP32 using the Blynk IOT PLataform. I choose Blynk because it is easier to implement IOT with ESP32. Not the best, but it works! My ESP32 DVM sent voltage values to my Tablet (Blynk application) through the Blynk Cloud Server. The sending data rate must be at least 1 value per second. Restriction of the free Blynk server.Blynk Getting Started Guide -> Documentation -> Sketch generator -> Youtube Video - ESP32 DVM7135 Blybk IOT Tests : This is the code I used :   // ESP32 - DVM7135 - Blynk IOT Tests // ESP32 DEVKIT - ARDUINO IDE 1.8.5 - TLC7135 - PCF8574 // Gustavo Murta 21/03/2018 // Use I2C pullup Resistors 3K3 ohms /*Blynk Getting Started Guide -> Blynk Documentation -> Blynk Sketch generator -> Youtube video -> BSD 3-Clause Open Source License 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include <Wire.h> // ESP32 I2C Interface Library #include <WiFi.h> // ESP32 WIFI Library #include <WiFiClient.h> // ESP32 WIFI Client Library #include <BlynkSimpleEsp32.h> // Blynk Library # define BLYNK_PRINT Serial # define CLOCK 2 // TCL7135 pin22 CLKIN => GIPO_2 # define STB 4 // TCL7135 pin26 -STB => GPIO_4 # define RHLD 5 // TCL7135 pin25 RUN/-HOLD => GPIO_5 # define SDApin 21 // PCF8574 SDA pin15 => GPIO_21 # define SCLpin 22 // PCF8574 SCL pin14 => GPIO_22 # define PCF8574 0x20 // PCF8574 Address char auth[] = "123456789ABCDEFGHIJKLMN"; // Blynk Application Token key char ssid[] = "Router SSID"; // Wifi Router name char pass[] = "Router Password"; // Wifi Router password byte Digit5, Digit4, Digit3, Digit2, Digit1 = 0; // Digits of TLC7135 byte pcfData = 0; int DigitCount = 0 ; char Signal ; float Voltage = 0; void setup() { pinMode (STB, INPUT); // Interrupt - ESP32 GPIO_4 pinMode (RHLD, OUTPUT); // RUN DVM - ESP32 GIPO_5 // TLC7135 pin22 CLKIN => GPIO_2 generate CLOCK 480 KHz pinMode(CLOCK, OUTPUT); // GPIO_2 as Output ledcAttachPin(CLOCK, 0); // GPIO_2 attached to PWM Channel 0 ledcSetup(0, 480000, 2); // Channel 0 , freq 480 KHz , 2 bit resolution ledcWrite(0, 2); // Enable frequency with duty cycle 50% digitalWrite(RHLD, LOW); // Reset DVM TLC7135 delay(10); digitalWrite(RHLD, HIGH); // Run DVM TLC7135 Serial.begin(115200); attachInterrupt(digitalPinToInterrupt(STB), TestData, FALLING); // External Interrupt GPIO_4 Wire.begin (SDApin, SCLpin); // sda= GPIO_21 /scl= GPIO_22 Blynk.begin(auth, ssid, pass); // Connecting Blink Cloud Server } void ReadData () { Wire.begin(); // Start I2C Wire.requestFrom(PCF8574, 1); // Read One Byte from PCF8574 pcfData =; // Byte Read } void PrintData () { Serial.print(" TLC7135 Data = "); // Print Voltage to adjustments of VRef Serial.print(Signal); // Signal Plus or Minus Serial.print(" "); Serial.print(Digit5, HEX); Serial.print(","); Serial.print(Digit4, HEX); Serial.print(Digit3, HEX); Serial.print(Digit2, HEX); Serial.print(Digit1, HEX); } void UnderVoltage () { if ( bitRead(pcfData, 7)) // Bit7 PCF8574 => Under Voltage Serial.println(" Under Voltage "); } void OverVoltage () { if ( bitRead(pcfData, 6)) // Bit6 PCF8574 => Over Voltage Serial.println(" Over Voltage "); } void Polarity () { if ( bitRead(pcfData, 5)) // Bit5 PCF8574 => Polarity + or - { Signal = '+' ; } else { Signal = '-' ; } } void PrintVoltage () // Print Voltage X,XXX { Voltage = ((Digit5 * 10000) + (Digit4 * 1000) + (Digit3 * 100) + (Digit2 * 10) + Digit1) / 10000.0 ; ; Serial.print(" Voltage = "); Serial.print(Signal); Serial.println(Voltage, 3); } void TestData () { ReadData (); Polarity(); if ( bitRead(pcfData, 4)) // Test if TLC7135 Digit 5 is on (bit 4 of PCF8574) { Digit5 = pcfData & 0x0F ; // Read first Byte DigitCount = 0 ; // Reset Digit Count DigitCount = ++DigitCount ; // Digit Count increment } if (! (bitRead(pcfData, 4))) // Test If bit 4 of PCF8574 is Off - Not Digit 5 switch (DigitCount) { case 1 : Digit4 = pcfData & 0x0F ; // Read 2nd Byte - Digit 4 DigitCount = ++DigitCount ; // Digit Count increment break ; case 2 : Digit3 = pcfData & 0x0F ; // Read 3rd Byte - Digit 3 DigitCount = ++DigitCount ; // Digit Count increment break ; case 3 : Digit2 = pcfData & 0x0F ; // Read 4th Byte - Digit 2 DigitCount = ++DigitCount ; // Digit Count increment break ; case 4 : Digit1 = pcfData & 0x0F ; // Read 5th Byte - Digit 1 DigitCount = ++DigitCount ; // Digit Count increment PrintData (); PrintVoltage (); break ; default : break; } OverVoltage (); //UnderVoltage (); } BLYNK_READ(V0) { Blynk.virtualWrite(V0, Voltage); // Send Voltage Value V0 to Blynk Cloud Server delay(1000); // minimum delay MUST BE 1 second ! } void loop() {; // Blynk running }  
ESP32 Digital Voltmeter
Thomas Beck
Thomas Beck vor 3 Stunden
This project update adds support for the Arduino Due and experimental support for the Waveshare 3.2/3.5/4inch TFT touch shields for Arduino.Parts used for the OBD2 for Arduino Due prototype: 1. Arduino Due (clone) 2. Waveshare 2.8inch TFT touch shield for Arduino 3. Arduino Proto Shield MEGA-Rev3 with SPI stacking header 4. Diamex Pi-OBD module + OBD2 cable 5. 12V vehicle socket to USB adapter to power the Arduino via USB Detailed installation instructions for Arduino M0/M0/Pro and Due covering hardware, software and wiring are given in file installation.txt.Changes: - added Arduino Due specific code for timer and SPI configuration   This is automatically activated if Due board is selected in Arduino IDE. - the OBD2 module and the serial device used to communicate with it can be configured via the new configuration file Obd2ModuleCfg.h - the TFT touch shield variant and the SPI used to communicate with the SPI slave devices on it can be configured via the new configuration file TftTouchShieldCfg.h   This file also contains information about the different variants of the Waveshare 3.2/3.5/4inch TFT touch shields. - additional TFT frame buffer drivers are provided in ILI9341.cpp/h for the Waveshare 3.2inch TFT touch shield and in ILI9486.cpp/h for the Waveshare 3.5/4inch TFT touch shields   For the 3.2inch shield with TFT display size 240 x 320, the 96 x 132 LCD display frame buffer coming from the libhhgui.a is doubled for output (like it is done for the 2.8inch shield).   For the 3.5/4inch shields with TFT display size 320 x 480, the 96 x 132 LCD display frame buffer coming from the libhhgui.a is trippled for output. The display update of the 3.5/4inch shields is slower, due to the larger amount of display data that must be transmitted via SPI. - renamed TFT class to TFTFB class (TFT frame buffer) to avoid compiler warning about ambiguity with the Arduino TFT library - decreased minimum touch pressure threshold XPT2046_MIN_PRESSURE in touch panel driver file XPT2046.cpp   The minimum touch pressure value that must be read from the panel helps to filter out touch release and slight touches.   While adding support for the 3.2/3.5/4inch TFT touch shields, I discovered that after warm-up of the panel, the read pressure value significantly decreases in some areas of the panel, sometimes falling below the threshold used up to now. The same happens to the read position values. - made the OBD2 module Reset pin available for the Diamex DXM OBD2 module, too - connecting the OBD2 module Reset pin is optional, now. You can leave that pin open. However, I recommend to use the Reset pin.   On both Diamex OBD2 modules there is a pull-up resistor mounted/configured that pulls the input high to disable reset.   The software has been changed to send an initial software reset command, if the serial connection to the module hangs at startup. - connecting the OBD2 module BIOS/Bootloader pin to GND (= selecting BIOS) is optional. You can leave that pin open.   On both Diamex OBD2 modules there is a pull-down resistor mounted/configured that pulls the input low to select BIOS. - libhhgui.a comes in two variants now, one for M0/M0 Pro/Zero as libhhgui_samd21.a and one for Due as libhhgui_sam3x8e.a   However, the OBD2-Analyser NG firmware in libhhgui_xxx.a is unchanged. Therefore, the supported OBD2 features are still as given in chapter 1 on the main project page and OBD2 for Arduino is still showing version number 1.9.0 at startup. - the file platform.local.txt has been changed to overwrite the recipe.c.combine.pattern of the platform.txt file to add the correct libhhgui_xxx.a to the linking process   Therefore, this file comes in two variants now, one for M0/M0 Pro/Zero and one for Due. - editing platform.txt is no longer necessary   So, other Arduino projects can be build if just the platform.local.txt file is removed. - sequence of pin initialization has been made independent from Arduino initialization functions   While porting the project to Arduino Due, I discovered that initializing pins in constructors that initialize global objects must not be done. For the current Arduino M0/M0 Pro/Zero source in main.cpp it works because __libc_init_array() is called after init(). init() contains the default pin initialization and __libc_init_array() calls the constructors. So, the sequence is correct. However, for the Arduino Due things are different. Here main.cpp calls init() and init() calls __libc_init_array() before it disables the pull-ups on every pin via digitalWrite(pin, LOW). So, here the desired pin configuration is destroyed. - the SDCard chip select pin misconfiguration bugfix released on the main project page a few days ago is done via pin defines in the TftTouchShieldCfg.h file, now   While porting the project to Arduino Due, I found a serious bug in SDCard.h. A missing 'static' in front of the SDCard chip select pin number constant lead to misconfiguration of SD chip select pin 5 as pin 0 (constructor is called before constant is initialized). As a result pin 5 just got the default configuration of Arduino M0 Pro init() function in wiring.c: input without pull-up/down. Since the TFT touch shield has a pull-up mounted for signal line SD_CS, SD_CS is pulled high (= chip deselected). Exactly that is the desired behaviour, so the error heals itself. Instead of pin 5 serial Rx pin 0 is misconfigured as output high before a call to Serial1.begin() in the Arduino setup() function heals that, too. However, for a very short time during initialization two outputs are connected. So, you see, it is always wise to add those current limiting resistors in the Tx/Rx lines I mentioned in chapter 3.3 of the main project page ;)Notes for users who already have built the project for M0/M0 Pro/Zero: If you already have built the project for the M0/M0 Pro/Zero according to the information and code provided on the main project page, you must at least apply the bugfix I have released on the main project page a few days ago! However, due to the other improvements described above, I recommmend updating according to the new installation instructions in file installation.txt. - the SPI default for M0/M0 Pro/Zero has changed from pins 11, 12 and 13 to ICSP header   While porting the project to Arduino Due, I used the Arduino Proto Shield MEGA-Rev3 for the M0 Pro, too. So, changing the default to SPI via SPI/ICSP header saved me from having to change the configuration file every time when switching boards.   This configuration can be changed in the new configuration file TftTouchShieldCfg.h. - the default for the OBD2 module reset pin has changed from 8 to 2, since the Waveshare 3.2/3.5/4inch TFT touch shields use pin 8 for TFT reset.   This configuration can be changed in the new configuration file Obd2ModuleCfg.h. - since editing platform.txt is no longer necessary, undo the changes in platform.txt and just use and edit the new platform.local.txt from M0_Pro_Zero\platform.local.txtNotes about Waveshare 3.2/3.5/4inch TFT touch shields: The Waveshare 3.2/3.5/4inch TFT touch shield support is experimental because I just had the first version of those shields for testing and I no longer had these shields when porting the project to the Due. You might have to change the display orientation or other register initialization to your needs. There are at least two versions of each of those shields. The first batch of the shields works with 3.3V logic levels only. The first batch is missing the 74VHC125 level shifter. Furthermore, the first batch is missing the backlight control pin. Additionally, several condensers have been added to the second batch. Therefore, try to get the version with level shifters, additional condensers and backlight pin. The 4inch shield, at least the first batch of it without backlight control, needs an external power supply. The voltage regulator on the Arduino UNO or Arduino M0 Pro is not strong enough to power it. Therefore, the 4inch shield has not been tested with the OBD2 for Arduino project. Since the backlight of the second batch can be regulated by PWM, the second batch might work without separate power supply, if the backlight is dimmed. The larger shields become quite hot. As a result, the data acquired from the touch panel is subject to a significant thermal drift. However, the center of the panel still returns quite stable touch data. So, another touch panel data acquisition strategy might be necessary to reliably detect Up/Down/Esc/Ok presses.
OBD2 for Arduino
ddk vor 19 Stunden
3 Units have been assembled using  different ESP32 development baords ( ESP32 PICO core board , ESP32 Thing and a DOIT ESP32 ) initial source may be found at my Github account. ( ) many of the animations have been adapted from the FastLed community. There are some unused functions to include an EEPROM so that device behavious is persistent acrosss reboots/shutdowns, and a Button handler so teh user can select an animation they like which can also be synchronised to other units. The device can be powered by a "USB power bank" and has lasted  - 3 nights at a festival with a 2000 mAh supply ( depending on the LED brightness setting )
CARel vor 1 Tag
Hello I'm CARel winner!