|
Idézet: „With distance more than approximately 5 feet (1.5 meters), you may need to use a powered USB hub, as the USB port on your computer does not supply enough power to stretch over distance.”
Dugd át egy nagy áramú (>500mA) USB portba akkor működnie kellene.
Sziasztok! Adott egy ESP32. Letöltöttem arduinoban a legfrissebb könyvtárat hozzá (2.xxx) Osx alatt egyszerűen képtelenség beüzemelni. Sikerült ez itt bárkinek valahogy? Mindenféle python error van. Most már odáig eljutottam, hogy ez a hiba: Traceback (most recent call last):
File "esptool/loader.py", line 57, in <module>
File "PyInstaller/loader/pyimod02_importers.py", line 352, in exec_module
File "serial/tools/list_ports.py", line 31, in <module>
File "PyInstaller/loader/pyimod02_importers.py", line 352, in exec_module
File "serial/tools/list_ports_posix.py", line 33, in <module>
File "PyInstaller/loader/pyimod02_importers.py", line 352, in exec_module
File "serial/tools/list_ports_osx.py", line 26, in <module>
File "PyInstaller/loader/pyimod02_importers.py", line 352, in exec_module
File "ctypes/__init__.py", line 7, in <module>
ImportError: dlopen(/var/folders/7_/p8pscx8x6f591tt7dc_ty4r00000gn/T/_MEIjJve7F/lib-dynload/_ctypes.cpython-38-darwin.so, 2): Symbol not found: _ffi_closure_alloc
Referenced from: /var/folders/7_/p8pscx8x6f591tt7dc_ty4r00000gn/T/_MEIjJve7F/lib-dynload/_ctypes.cpython-38-darwin.so (which was built for Mac OS X 10.15)
Expected in: /usr/lib/libffi.dylib
in /var/folders/7_/p8pscx8x6f591tt7dc_ty4r00000gn/T/_MEIjJve7F/lib-dynload/_ctypes.cpython-38-darwin.so
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "esptool.py", line 31, in <module>
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "PyInstaller/loader/pyimod02_importers.py", line 352, in exec_module
File "esptool/__init__.py", line 41, in <module>
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "PyInstaller/loader/pyimod02_importers.py", line 352, in exec_module
File "esptool/cmds.py", line 14, in <module>
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "PyInstaller/loader/pyimod02_importers.py", line 352, in exec_module
File "esptool/bin_image.py", line 14, in <module>
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "PyInstaller/loader/pyimod02_importers.py", line 352, in exec_module
File "esptool/loader.py", line 62, in <module>
AttributeError: module 'sys' has no attribute 'VERSION'
[33007] Failed to execute script 'esptool' due to unhandled exception!
exit status 1
Hiba a(z) ESP32S3 Dev Module alaplapra fordításra.
Van valakinek ötlete mi lehet ez?
Hozzáértőket kérdezném.
Samsung PM883 SSD adatlapot nézem, konkrétan ezt: Bővebben: Link
A 8. oldal alján van egy ilyen paraméter:
Data Retention: 3months
notE:
1) Data retention was measured by assuming that SSD reaches the maximum rated endurance at 40'C in power-off state.
Jól értem, hogy kikapcsolt állapotban, 40°C-on tárolva, már 3 hónap után adatot veszthet?? A hozzászólás módosítva: Szept 3, 2023
Helló!
Még kezdő vagyok, segítséget kérek. Újratelepítettem a Win10 és az Arduinot is.
Azóta az Arduino letöltésnél a következőket írja ki.
Avrdude: Stk_getaync{} attempt 10 of 10: not in sync: resp=0x00
Előre is köszönöm a segítséget.
Üdv: Koczur42
The Timer/Counter Interrupt Mask register - TIMSK
4. Bit - OCIE1A: Timer/Counter1 Output CompareA Match Interrupt Enable
ebbe elég nehéz lenne egy egész bájtot(8bitet) beletölteni, ezért fúj szerintem.
De miért is ebbe a regiszterbe akarsz periódust tölteni? A hozzászólás módosítva: Aug 20, 2023
Köszönöm kedves Kapu48!
Hasonló kóddal megpróbálkoztam ESP32-val, de az instabilabbnak tűnt. Nyilván az ismereteim alapján készíthető "legmagasabb szintű" kóddal, amiben egyszer olvasunk be analógot, és persze használjuk a tone funkciót...
Köszönöm kedves ASCH!
Néhány sort megpirosozott, de némi kiegészítéssel a mellékletig jutottam.
A fordító kifogása: Compilation error: lvalue required as left operand of assignment,
magyarul: Fordítási hiba: lvalue szükséges a hozzárendelés bal oldali operandusaként
Ez mit jelenthet, illetve mit tegyek?
Nem gondolom, hogy számít, de nincs csatlakoztatva a NANO a PC-hez...
Köszönettel; Tambi A hozzászólás módosítva: Aug 19, 2023
Körte! Ezt nem írtad még 
Ezt véletlen (tényleg véletlen) tudom.
Az úgy volt: a nejem vett Osonba olcsó LED-körtét, aztán otthon kiderült: 1000 ft-al többet fizetett érte, mint a polcon olvasta. Megnéztem a dobozt: rá volt írva, hogy szabályozható, és szó szerint úgy, a "dim" szócska szerepelt. De a pontos mondatra nem emlékszem. (Simán: valaki visszadobta, mint szokták -csak pont nem jó helyre. Még jó, hogy nem a virslik közé. Mert szokták úgy)
Tehát ha látod (és véletlen sem " not dim"), akkor dimmelhető.
Nekünk semmi szükségünk a dimmelhetőre, de csak ezért nem mentünk vissza Szigetszentmiklósra, hogy igenis cseréljük vissua az olcsóbra
Sziasztok !
Ezt az akvárium vezérlőt szeretném megépíteni: /aquacontrol aquacontrol .
Az Arduino Ide az ellenőrzéskor ezeket a hibákat írja ki :
In file included from d:\Documents\Arduino\libraries\ esp8266-oled-ssd1306-3.2.5/SSD1306Wire.h:31,
from d:\Documents\Arduino\libraries\ esp8266-oled-ssd1306-3.2.5/SSD1306.h:30,
from D:\Documents\Akvarium\aquacontrol-master\aquacontrol-master\aquacontrol\aquacontrol.ino:35:
d:\Documents\Arduino\libraries\ esp8266-oled-ssd1306-3.2.5/OLEDDisplay.h: In member function 'virtual bool OLEDDisplay::connect()':
d:\Documents\Arduino\libraries\ esp8266-oled-ssd1306-3.2.5/OLEDDisplay.h:253:29: error: no return statement in function returning non-void [-Werror=return-type]
253 | virtual bool connect() {};
| ^
D:\Documents\Akvarium\aquacontrol-master\aquacontrol-master\aquacontrol\aquacontrol.ino: At global scope:
D:\Documents\Akvarium\aquacontrol-master\aquacontrol-master\aquacontrol\aquacontrol.ino:61:41: error: 'PWMRANGE' was not declared in this scope
61 | unsigned int PWMdepth = PWMRANGE * 10; //PWMRANGE defaults to 1023 on ESP8266 in Arduino IDE
| ^~~~~~~~
D:\Documents\Akvarium\aquacontrol-master\aquacontrol-master\aquacontrol\aquacontrol.ino: In function 'void setup()':
D:\Documents\Akvarium\aquacontrol-master\aquacontrol-master\aquacontrol\aquacontrol.ino:223:5: error: 'startAP' was not declared in this scope
223 | startAP();
| ^~~~~~~
D:\Documents\Akvarium\aquacontrol-master\aquacontrol-master\aquacontrol\aquacontrol.ino:256:17: error: 'now' was not declared in this scope; did you mean 'pow'?
256 | int endTime = now() + 30;
| ^~~
| pow
D:\Documents\Akvarium\aquacontrol-master\aquacontrol-master\aquacontrol\aquacontrol.ino:266:5: error: 'startAP' was not declared in this scope
266 | startAP();
| ^~~~~~~
D:\Documents\Akvarium\aquacontrol-master\aquacontrol-master\aquacontrol\aquacontrol.ino:322:8: error: 'defaultTimersAreLoaded' was not declared in this scope
322 | if ( defaultTimersAreLoaded() ) {
| ^~~~~~~~~~~~~~~~~~~~~~
D:\Documents\Akvarium\aquacontrol-master\aquacontrol-master\aquacontrol\aquacontrol.ino:414:21: error: 'getTimefromNTP' was not declared in this scope
414 | time_t result = getTimefromNTP();
| ^~~~~~~~~~~~~~
D:\Documents\Akvarium\aquacontrol-master\aquacontrol-master\aquacontrol\aquacontrol.ino:416:7: error: 'setTime' was not declared in this scope
416 | setTime( result );
| ^~~~~~~
D:\Documents\Akvarium\aquacontrol-master\aquacontrol-master\aquacontrol\aquacontrol.ino:428:34: error: 'localTime' was not declared in this scope; did you mean 'localtime'?
428 | Serial.println( formattedTime( localTime() ) );
| ^~~~~~~~~
| localtime
D:\Documents\Akvarium\aquacontrol-master\aquacontrol-master\aquacontrol\aquacontrol.ino:428:19: error: 'formattedTime' was not declared in this scope
428 | Serial.println( formattedTime( localTime() ) );
| ^~~~~~~~~~~~~
D:\Documents\Akvarium\aquacontrol-master\aquacontrol-master\aquacontrol\aquacontrol.ino:447:57: error: 'updateChannels' was not declared in this scope
447 | channelUpdateTimer.attach_ms( 1000 / updateFrequency, updateChannels ); // Finally set the timer routine to update the leds
| ^~~~~~~~~~~~~~
D:\Documents\Akvarium\aquacontrol-master\aquacontrol-master\aquacontrol\aquacontrol.ino:451:3: error: 'showHostname_IP_OLED' was not declared in this scope
451 | showHostname_IP_OLED();
| ^~~~~~~~~~~~~~~~~~~~
D:\Documents\Akvarium\aquacontrol-master\aquacontrol-master\aquacontrol\aquacontrol.ino: In function 'void loop()':
D:\Documents\Akvarium\aquacontrol-master\aquacontrol-master\aquacontrol\aquacontrol.ino:473:5: error: 'showHostname_IP_OLED' was not declared in this scope
473 | showHostname_IP_OLED();
| ^~~~~~~~~~~~~~~~~~~~
D:\Documents\Akvarium\aquacontrol-master\aquacontrol-master\aquacontrol\aquacontrol.ino:483:41: error: 'now' was not declared in this scope; did you mean 'pow'?
483 | if ( !serverClient && nextSyncTime <= now() ) {
| ^~~
| pow
D:\Documents\Akvarium\aquacontrol-master\aquacontrol-master\aquacontrol\aquacontrol.ino:485:21: error: 'getTimefromNTP' was not declared in this scope
485 | time_t result = getTimefromNTP();
| ^~~~~~~~~~~~~~
D:\Documents\Akvarium\aquacontrol-master\aquacontrol-master\aquacontrol\aquacontrol.ino:487:7: error: 'setTime' was not declared in this scope
487 | setTime( result );
| ^~~~~~~
D:\Documents\Akvarium\aquacontrol-master\aquacontrol-master\aquacontrol\aquacontrol.ino:499:71: error: 'localTime' was not declared in this scope; did you mean 'localtime'?
499 | Serial.print( F("RAW HTTP @ ") ); Serial.print( formattedTime( localTime() ) ); Serial.print( F(" ") ); Serial.println( request );
| ^~~~~~~~~
| localtime
D:\Documents\Akvarium\aquacontrol-master\aquacontrol-master\aquacontrol\aquacontrol.ino:499:56: error: 'formattedTime' was not declared in this scope
499 | Serial.print( F("RAW HTTP @ ") ); Serial.print( formattedTime( localTime() ) ); Serial.print( F(" ") ); Serial.println( request );
| ^~~~~~~~~~~~~
D:\Documents\Akvarium\aquacontrol-master\aquacontrol-master\aquacontrol\aquacontrol.ino:506:7: error: 'fileSend' was not declared in this scope; did you mean 'fileno'?
506 | fileSend( "/index.htm" );
| ^~~~~~~~
| fileno
D:\Documents\Akvarium\aquacontrol-master\aquacontrol-master\aquacontrol\aquacontrol.ino:512:7: error: 'procesApiCall' was not declared in this scope
512 | procesApiCall( request );
| ^~~~~~~~~~~~~
D:\Documents\Akvarium\aquacontrol-master\aquacontrol-master\aquacontrol\aquacontrol.ino:517:7: error: 'fileSend' was not declared in this scope; did you mean 'fileno'?
517 | fileSend( request.substring( 4, request.lastIndexOf( " " ) ) );
| ^~~~~~~~
| fileno
D:\Documents\Akvarium\aquacontrol-master\aquacontrol-master\aquacontrol\aquacontrol.ino:527:3: error: 'updateOLEDbar' was not declared in this scope
527 | updateOLEDbar();
| ^~~~~~~~~~~~~
cc1plus.exe: some warnings being treated as errors
exit status 1
Compilation error: 'PWMRANGE' was not declared in this scope.
Tudnátok ebben segíteni ?
Tibi
Sziasztok!
Bővebben: Link
Szeretnék egy kis segítséget kérni a hozzáértőktől. Egy ilyen ESP32 Arduino LVGL WIFI&Bluetooth Development Board 2.8" -ról lenne szó. Szeretnénk power bankról használni de minden egyes kipróbált power bank ledobja ha készenlétbe megy.
Valamilyen tápegységet szeretnénk építeni hozzá ami egy 18650 celláról tud menni.
Egyébként ebben az alkalmazásban szeretnénk használni mintegy hordozható kezelő, vagy távirányító.
Bővebben: Link
Az általad adott link utolsó kommentje pont erről szól:
Idézet: „Device is not correctly display readings consumption (when 227в and 0,23а shows 14 Watt consumption), it can be as the calibrate?”
Itt is az az anyázás tárgya, hogy nem jött ki neki a matek:
227 x 0.23 = 52 és nem 14
Tedd rá üresen egy fogyasztásmérőre (ez is az elvileg), és nézd meg, hogy egy óra alatt mennyi Wh-t fogyaszt.
Az melegíti a transzformátort (a vasmagját leginkább).
OFf de,
Mi a Joistent csinalnak a forummal,
tobb forumtarssal napok ota levelezel maganba, innen a topikbol is akku ugyben.
mai naptol nem enged valaszolni senkinek, not allowed....
"Ennek a szemelynek nem engedelyezett az uzenet"
Senkinek se...?? Mobilrol se, PC-rol se megy a privat uzenet. Mindenki nem tiltott le 12 ora leforgasa alatt az biztos.
Fura is lett volna, ha egy bizti hangját hallod, két ellenállásét meg nem. Az olcsó kategóriában valóban nincsenek nagy különbségek. Beteszek ide egy képet ami nálam ezekről kialakult az évek során, ha csak egy embernek segítek vele már megérte. Balról jobbra megyünk, vagyis a legsilányabb hangot a 1206-os VIK produkálja ezekből, a legjobbat meg az a 2W-os akármi a jobb oldalon, azokhoz azért nincs gyártó írva mert nem tudom ki a gyártója.
Kicsik ugyan a különbségek, de ha azt nézzük, hogy a bal és a jobb oldal közt van mondjuk egy 10-es skálán 1 pont különbség (6 és7) akkor azért az nem is olyan kicsi. Hogy hol van a határ azt meg mindenki eldönti magának, csak az nagyon furán veszi ki magát amikor valaki határozott véleményt alkot egy alkatrészről úgy, hogy nem hogy nem próbálta, de még képen se látta. 
Az a kis szénréteg pl. engem nagyon meglepett, régen az ilyeneket eldobáltam de legalábbis erősítőbe sosem raktam be, mondom szén, fúj, vacak, és nem hogy nem az, hanem az olcsó kategóriában az a legjobb, be is táraztam belőlük, hátha kell még valaha.
Állítólag a csúcs az a Shinkoh tantál de olyat ezen a fórumon biztosan nem sokan használnak mert 10-20 font + áfa darabja. Meg állítólag az AN ellenállásai is nagyon jók, de ott pl. az ezüst nióbium közel 50 font + áfa...
A felhasznált alkatrészek szerintem legalább 25%-ban meghatározzák egy erősítő hangját, és ez visszaköszön a gyári készülékekben is.
Az rs458/422 és az i2c nem összehasonlítható dolgok. Az rs458 csak a fizikai réteget definiálja,
az i2c az adatkapcsolatot (címzés, lekérdezés) is. Ezért is szeretjük.
Az i2c jeleket -ahhoz képest, ami egy kontrolleből jön, lehet robusztussá tenni.
Differenciálmódusuvá változtatni, feszültséget növelni. Ettől nem lesz rs458, de hasonlóan zajvédett lesz. Galvanikus izoláció nem feltétlen szükséges. Csavart érpáron nagyobb távolságú kommunikáció lehetséges ezáltal.
i2c-over-long-wires
Az idézett PCA9615 IC nem is drága, kapható is.
Egy másik, hasonló app note: Bővebben: Link
// note: RESET pin is used as a weak analog input for the set button and the NTC
// thermistor. You don't need to disable the RESET pin as the voltage won't
// go below 40% of Vcc.
Meg kell mérni a RESET lábon a feszültséget, benne kell legyen a határadatokban.
// RESET pin ADC values (tweak a little, if button/NTC do not work correctly)
#define NTCMIN 550 // lowest ADC value for NTC; below is a button press
#define NTCFAN 625 // turn on the fan if ADC value is below
#define NTCHOT 560 // show warning screen if ADC value is below
Ha nem működik jól a gomb akkor állítani kell az értékeken. Érdemes lenne kinyerni a programból az ADC adatokat, vagy ha az egyszerűbb írni kell egy ADC lekérdező programot, és a kapott adatok alapján beállítani a határértékeket.
Üdv mesterek!
A következő gondom lenne megépítettem ezt az áramkört működik is csak éppen nem lehet vagy csak véletlen lehet váltani a két kijelzés között a SET gombbal hiába nyomkodom.
https://oshwlab.com/wagiminator/y-attiny85-electronic-load
Itt van a kód is:
// ===================================================================================
// Project: TinyLoad - Simple Electronic Constant Current Dummy Load (ATtiny45/85)
// Version: v1.2
// Year: 2020 - 2021
// Author: Stefan Wagner
// Github: https://github.com/wagiminator
// ===================================================================================
//
// Description:
// ------------
// The ATtiny measures voltage, current and temperature of the heat sink,
// calculates power, energy and electric charge, controls the fan and displays
// all relevant data on the OLED. The button is used to switch between
// power/resistance and energy/charge display.
//
// References:
// -----------
// The I²C OLED implementation is based on TinyOLEDdemo
//
// OLED font was adapted from Neven Boyanov and Stephen Denne
//
// Wiring:
// -------
// +-\/-+
// Button/NTC --- RST ADC0 PB5 1|° |8 Vcc
// Voltage Sensor ------- ADC3 PB3 2| |7 PB2 ADC1 -------- OLED SCK
// Current Sensor ------- ADC2 PB4 3| |6 PB1 AIN1 OC0B --- Fan Control
// GND 4| |5 PB0 AIN0 OC0A --- OLED SDA
// +----+
//
// Compilation Settings:
// ---------------------
// Core: ATtinyCore (https://github.com/SpenceKonde/ATTinyCore)
// Board: ATtiny25/45/85 (No bootloader)
// Chip: ATtiny45 or 85 (depending on your chip)
// Clock: 1 MHz (internal)
// B.O.D.: 2.7V
//
// Leave the rest on default settings. Don't forget to "Burn bootloader"!
// No Arduino core functions or libraries are used. Use the makefile if
// you want to compile without Arduino IDE.
//
// note: RESET pin is used as a weak analog input for the set button and the NTC
// thermistor. You don't need to disable the RESET pin as the voltage won't
// go below 40% of Vcc.
//
// Fuse settings: -U lfuse:w:0x62:m -U hfuse:w:0xd5:m -U efuse:w:0xff:m
//
// Operating Instructions:
// -----------------------
// The ADC of the ATtiny does its best to make the tinyLoad a pretty accurate
// tool, but it might need a little calibration.
//
// How to calibrate:
// Set ULCAL and ILCAL to "1" in the sketch, compile and upload.
// Choose a stable input voltage of around 5V and turn the poti until the
// display shows a current of around 0.7A. Measure the voltage and the current
// with a trusty multimeter or a good lab bench power supply.
// Calculate the voltage calibration factor as follows:
// ULCAL = voltage measured with multimeter / voltage shown on OLED.
// Calculate the current calibration factor as follows:
// ILCAL = current measured with multimeter / current shown on OLED.
// Set the ULCAL and ILCAL value in the sketch, compile and upload again.
//
// notes:
// - Use a good heatsink with a 5V fan for the MOSFET!
// - Be careful with high power loads! This device is called "tinyLoad" for a reason!
// - Always turn the POTI full counter-clockwise before connecting the load!
// - Due to the input offset voltage of the OpAmp the minimum load current is 17mA.
// - The maximum load current is 4.5A, however for small voltages it might be less.
// - Do not exceed the maximum voltage of 26V!
// ===================================================================================
// Libraries, Definitions and Macros
// ===================================================================================
// Libraries
#include <avr/io.h> // for GPIO
#include <avr/sleep.h> // for sleep functions
#include <avr/pgmspace.h> // for data stored in program memory
#include <avr/interrupt.h> // for interrupts
#include <util/delay.h> // for delays
// Pin assignments
#define PIN_SDA PB0 // I2C serial data pin, connected to OLED
#define PIN_SCL PB2 // I2C serial clock pin, connected to OLED
#define PIN_FAN PB1 // pin connected to MOSFET for fan control
#define PIN_VOLTAGE PB3 // pin for voltage measurement
#define PIN_CURRENT PB4 // pin for current measurement
#define PIN_NTC PB5 // pin connected to NTX and button
// Calibration values for internal 1.1V reference
#define ULCAL 1 // linear voltage calibration factor
#define ILCAL 0.921 // linear current calibration factor
// Parameter definitions
#define MAXPOWER 15 // max power in watt
#define UCONV 11486336 // voltage conversion = 1000*64*1023*R11/(R10+R11)
#define ICONV 72019200 // current conversion = 1000*64*1023*R_shunt*(R8+R9)/R9
// RESET pin ADC values (tweak a little, if button/NTC do not work correctly)
#define NTCMIN 550 // lowest ADC value for NTC; below is a button press
#define NTCFAN 625 // turn on the fan if ADC value is below
#define NTCHOT 560 // show warning screen if ADC value is below
// Pin manipulation macros
#define pinInput(x) DDRB &= ~(1<<(x)) // set pin to INPUT
#define pinOutput(x) DDRB |= (1<<(x)) // set pin to OUTPUT
#define pinLow(x) PORTB &= ~(1<<(x)) // set pin to LOW
#define pinHigh(x) PORTB |= (1<<(x)) // set pin to HIGH
#define pinDisable(x) DIDR0 |= (1<<(x)) // disable digital input buffer
#define pinRead(x) (PINB & (1<<(x))) // READ pin
#define pinADC(x) ((x)==2?1:((x)==3?3:((x)==4?2:0))) // convert pin to ADC port
// Pin to ADC port conversion macros
#define AP_NTC pinADC(PIN_NTC) // ADC port of fan pin
#define AP_CURRENT pinADC(PIN_CURRENT) // ADC port of current sense pin
#define AP_VOLTAGE pinADC(PIN_VOLTAGE) // ADC port of voltage sense pin
// ===================================================================================
// I2C Master Implementation (write only)
// ===================================================================================
// I2C macros
#define I2C_SDA_HIGH() pinInput(PIN_SDA) // release SDA -> pulled HIGH by resistor
#define I2C_SDA_LOW() pinOutput(PIN_SDA) // SDA as output -> pulled LOW by MCU
#define I2C_SCL_HIGH() pinInput(PIN_SCL) // release SCL -> pulled HIGH by resistor
#define I2C_SCL_LOW() pinOutput(PIN_SCL) // SCL as output -> pulled LOW by MCU
// I2C transmit one data byte to the slave, ignore ACK bit, no clock stretching allowed
void I2C_write(uint8_t data) {
for(uint8_t i=8; i; i--, data<<=1) { // transmit 8 bits, MSB first
(data&0x80)?I2C_SDA_HIGH():I2C_SDA_LOW(); // SDA depending on bit
I2C_SCL_HIGH(); // clock HIGH -> slave reads the bit
I2C_SCL_LOW(); // clock LOW again
}
I2C_SDA_HIGH(); // release SDA for ACK bit of slave
I2C_SCL_HIGH(); // 9th clock pulse is for the ACK bit
I2C_SCL_LOW(); // but ACK bit is ignored
}
// I2C start transmission
void I2C_start(uint8_t addr) {
I2C_SDA_LOW(); // start condition: SDA goes LOW first
I2C_SCL_LOW(); // start condition: SCL goes LOW second
I2C_write(addr); // send slave address
}
// I2C stop transmission
void I2C_stop(void) {
I2C_SDA_LOW(); // prepare SDA for LOW to HIGH transition
I2C_SCL_HIGH(); // stop condition: SCL goes HIGH first
I2C_SDA_HIGH(); // stop condition: SDA goes HIGH second
}
// ===================================================================================
// OLED Implementation
// ===================================================================================
// OLED definitions
#define OLED_ADDR 0x78 // OLED write address
#define OLED_CMD_MODE 0x00 // set command mode
#define OLED_DAT_MODE 0x40 // set data mode
#define OLED_INIT_LEN 9 // length of init command array
// Standard ASCII 5x8 font (adapted from Neven Boyanov and Stephen Denne)
const uint8_t OLED_FONT[] PROGMEM = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2F, 0x00, 0x00, 0x00, 0x07, 0x00, 0x07, 0x00,
0x14, 0x7F, 0x14, 0x7F, 0x14, 0x24, 0x2A, 0x7F, 0x2A, 0x12, 0x23, 0x13, 0x08, 0x64, 0x62,
0x36, 0x49, 0x55, 0x22, 0x50, 0x00, 0x05, 0x03, 0x00, 0x00, 0x00, 0x1C, 0x22, 0x41, 0x00,
0x00, 0x41, 0x22, 0x1C, 0x00, 0x14, 0x08, 0x3E, 0x08, 0x14, 0x08, 0x08, 0x3E, 0x08, 0x08,
0x00, 0x00, 0xA0, 0x60, 0x00, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x60, 0x60, 0x00, 0x00,
0x20, 0x10, 0x08, 0x04, 0x02, 0x3E, 0x51, 0x49, 0x45, 0x3E, 0x00, 0x42, 0x7F, 0x40, 0x00,
0x42, 0x61, 0x51, 0x49, 0x46, 0x21, 0x41, 0x45, 0x4B, 0x31, 0x18, 0x14, 0x12, 0x7F, 0x10,
0x27, 0x45, 0x45, 0x45, 0x39, 0x3C, 0x4A, 0x49, 0x49, 0x30, 0x01, 0x71, 0x09, 0x05, 0x03,
0x36, 0x49, 0x49, 0x49, 0x36, 0x06, 0x49, 0x49, 0x29, 0x1E, 0x00, 0x36, 0x36, 0x00, 0x00,
0x00, 0x56, 0x36, 0x00, 0x00, 0x08, 0x14, 0x22, 0x41, 0x00, 0x14, 0x14, 0x14, 0x14, 0x14,
0x00, 0x41, 0x22, 0x14, 0x08, 0x02, 0x01, 0x51, 0x09, 0x06, 0x32, 0x49, 0x59, 0x51, 0x3E,
0x7C, 0x12, 0x11, 0x12, 0x7C, 0x7F, 0x49, 0x49, 0x49, 0x36, 0x3E, 0x41, 0x41, 0x41, 0x22,
0x7F, 0x41, 0x41, 0x22, 0x1C, 0x7F, 0x49, 0x49, 0x49, 0x41, 0x7F, 0x09, 0x09, 0x09, 0x01,
0x3E, 0x41, 0x49, 0x49, 0x7A, 0x7F, 0x08, 0x08, 0x08, 0x7F, 0x00, 0x41, 0x7F, 0x41, 0x00,
0x20, 0x40, 0x41, 0x3F, 0x01, 0x7F, 0x08, 0x14, 0x22, 0x41, 0x7F, 0x40, 0x40, 0x40, 0x40,
0x7F, 0x02, 0x0C, 0x02, 0x7F, 0x7F, 0x04, 0x08, 0x10, 0x7F, 0x4E, 0x71, 0x01, 0x71, 0x4E,
0x7F, 0x09, 0x09, 0x09, 0x06, 0x3E, 0x41, 0x51, 0x21, 0x5E, 0x7F, 0x09, 0x19, 0x29, 0x46,
0x46, 0x49, 0x49, 0x49, 0x31, 0x01, 0x01, 0x7F, 0x01, 0x01, 0x3F, 0x40, 0x40, 0x40, 0x3F,
0x1F, 0x20, 0x40, 0x20, 0x1F, 0x3F, 0x40, 0x38, 0x40, 0x3F, 0x63, 0x14, 0x08, 0x14, 0x63,
0x07, 0x08, 0x70, 0x08, 0x07, 0x61, 0x51, 0x49, 0x45, 0x43, 0x00, 0x7F, 0x41, 0x41, 0x00,
0x02, 0x04, 0x08, 0x10, 0x20, 0x00, 0x41, 0x41, 0x7F, 0x00, 0x04, 0x02, 0x01, 0x02, 0x04,
0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x01, 0x02, 0x04, 0x00, 0x20, 0x54, 0x54, 0x54, 0x78,
0x7F, 0x48, 0x44, 0x44, 0x38, 0x38, 0x44, 0x44, 0x44, 0x20, 0x38, 0x44, 0x44, 0x48, 0x7F,
0x38, 0x54, 0x54, 0x54, 0x18, 0x08, 0x7E, 0x09, 0x01, 0x02, 0x18, 0xA4, 0xA4, 0xA4, 0x7C,
0x7F, 0x08, 0x04, 0x04, 0x78, 0x00, 0x44, 0x7D, 0x40, 0x00, 0x40, 0x80, 0x84, 0x7D, 0x00,
0x7F, 0x10, 0x28, 0x44, 0x00, 0x00, 0x41, 0x7F, 0x40, 0x00, 0x7C, 0x04, 0x18, 0x04, 0x78,
0x7C, 0x08, 0x04, 0x04, 0x78, 0x38, 0x44, 0x44, 0x44, 0x38, 0xFC, 0x24, 0x24, 0x24, 0x18,
0x18, 0x24, 0x24, 0x18, 0xFC, 0x7C, 0x08, 0x04, 0x04, 0x08, 0x48, 0x54, 0x54, 0x54, 0x20,
0x04, 0x3F, 0x44, 0x40, 0x20, 0x3C, 0x40, 0x40, 0x20, 0x7C, 0x1C, 0x20, 0x40, 0x20, 0x1C,
0x3C, 0x40, 0x30, 0x40, 0x3C, 0x44, 0x28, 0x10, 0x28, 0x44, 0x1C, 0xA0, 0xA0, 0xA0, 0x7C,
0x44, 0x64, 0x54, 0x4C, 0x44, 0x08, 0x36, 0x41, 0x41, 0x00, 0x00, 0x00, 0x7F, 0x00, 0x00,
0x00, 0x41, 0x41, 0x36, 0x08, 0x08, 0x04, 0x08, 0x10, 0x08, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF
};
// OLED init settings
const uint8_t OLED_INIT_CMD[] PROGMEM = {
0xC8, 0xA1, // flip screen
0xA8, 0x1F, // set multiplex ratio
0xDA, 0x02, // set com pins hardware configuration
0x8D, 0x14, // set DC-DC enable
0xAF // display on
};
// OLED variables
uint8_t OLED_x, OLED_y; // current cursor position
const uint16_t DIVIDER[] PROGMEM = {10000, 1000, 100, 10, 1}; // BCD conversion array
// OLED init function
void OLED_init(void) {
I2C_start(OLED_ADDR); // start transmission to OLED
I2C_write(OLED_CMD_MODE); // set command mode
for(uint8_t i = 0; i < OLED_INIT_LEN; i++)
I2C_write(pgm_read_byte(&OLED_INIT_CMD[i]));// send the command bytes
I2C_stop(); // stop transmission
}
// OLED set the cursor
void OLED_setCursor(uint8_t xpos, uint8_t ypos) {
I2C_start(OLED_ADDR); // start transmission to OLED
I2C_write(OLED_CMD_MODE); // set command mode
I2C_write(xpos & 0x0F); // set low nibble of start column
I2C_write(0x10 | (xpos >> 4)); // set high nibble of start column
I2C_write(0xB0 | (ypos & 0x07)); // set start page
I2C_stop(); // stop transmission
OLED_x = xpos; OLED_y = ypos; // set the cursor variables
}
// OLED clear line
void OLED_clearLine(uint8_t line) {
OLED_setCursor(0, line); // set cursor to line start
I2C_start(OLED_ADDR); // start transmission to OLED
I2C_write(OLED_DAT_MODE); // set data mode
for(uint8_t i=128; i; i--) I2C_write(0x00); // clear the line
I2C_stop(); // stop transmission
}
// OLED clear screen
void OLED_clearScreen(void) {
for(uint8_t i=0; i<4; i++) // 4 lines
OLED_clearLine(i); // clear line
}
// OLED plot a single character
void OLED_plotChar(char c) {
uint16_t ptr = c - 32; // character pointer
ptr += ptr << 2; // -> ptr = (ch - 32) * 5;
I2C_write(0x00); // write space between characters
for(uint8_t i=5 ; i; i--) I2C_write(pgm_read_byte(&OLED_FONT[ptr++]));
OLED_x += 6; // update cursor
if(OLED_x > 122) { // line end ?
I2C_stop(); // stop data transmission
OLED_setCursor(0,++OLED_y); // set next line start
I2C_start(OLED_ADDR); // start transmission to OLED
I2C_write(OLED_DAT_MODE); // set data mode
}
}
// OLED print a string from program memory
void OLED_printPrg(const char* p) {
I2C_start(OLED_ADDR); // start transmission to OLED
I2C_write(OLED_DAT_MODE); // set data mode
char ch = pgm_read_byte(p); // read first character from program memory
while(ch) { // repeat until string terminator
OLED_plotChar(ch); // print character on OLED
ch = pgm_read_byte(++p); // read next character
}
I2C_stop(); // stop transmission
}
// OLED print 8-bit value as 2-digit decimal (BCD conversion by substraction method)
void OLED_printDec8(uint8_t value) {
uint8_t digitval = 0; // start with digit value 0
while(value >= 10) { // if current divider fits into the value
digitval++; // increase digit value
value -= 10; // decrease value by divider
}
OLED_plotChar(digitval + '0'); // print first digit
OLED_plotChar(value + '0'); // print second digit
}
// OLED print 16-bit value as decimal (BCD conversion by substraction method)
void OLED_printDec16(uint16_t value) {
uint8_t leadflag = 0; // becomes "1" on first digit
for(uint8_t digit = 0; digit < 5; digit++) { // 5 digits
uint8_t digitval = 0; // start with digit value 0
uint16_t divider = pgm_read_word(&DIVIDER[digit]); // current divider
while(value >= divider) { // if current divider fits into the value
leadflag = 1; // end of leading spaces
digitval++; // increase digit value
value -= divider; // decrease value by divider
}
if(leadflag || (digit == 4)) OLED_plotChar(digitval + '0'); // print the digit
else OLED_plotChar(' '); // print leading space
}
}
// OLED print float right-aligned
void OLED_printValue(float value) {
value += 0.005; // for rounding
uint16_t front = value; // left side of decimal
uint8_t back = (value - front) * 100 ; // right side of decimal
I2C_start(OLED_ADDR); // start transmission to OLED
I2C_write(OLED_DAT_MODE); // set data mode
OLED_printDec16(front); // print left side of decimal
OLED_plotChar('.'); // print decimal
OLED_printDec8(back); // print right side of decimal
I2C_stop(); // stop transmission to OLED
}
// ===================================================================================
// Millis Counter Implementation for Timer0
// ===================================================================================
volatile uint32_t MIL_counter = 0; // millis counter variable
// Init millis counter
void MIL_init(void) {
OCR0A = 124; // TOP: 124 = 1000kHz / (8 * 1kHz) - 1
TCCR0A = (1<<WGM01); // timer0 CTC mode
TCCR0B = (1<<CS01); // start timer0 with prescaler 8
TIMSK = (1<<OCIE0A); // enable output compare match interrupt
}
// Read millis counter
uint32_t MIL_read(void) {
cli(); // disable interrupt for atomic read
uint32_t result = MIL_counter; // read millis counter
sei(); // enable interrupts
return result; // return millis counter value
}
// Timer0 compare match A interrupt service routine (every millisecond)
ISR(TIM0_COMPA_vect) {
MIL_counter++; // increase millis counter
}
// ===================================================================================
// ADC Implementation
// ===================================================================================
// Voltage references
#define REFVCC 0 // Vcc as reference
#define REF1V1 (1<<REFS1) // internal 1.1V reference
#define REF2V56 ((1<<REFS2) | (1<<REFS1)) // internal 2.56V reference
#define AVBG ((1<<MUX3) | (1<<MUX2)) // port of internal bandgap (1.1V reference)
// ADC init
void ADC_init(void) {
ADCSRA = (1<<ADPS1) | (1<<ADPS0) // set ADC clock prescaler to 8
| (1<<ADEN) // enable ADC
| (1<<ADIE); // enable ADC interrupt
}
// ADC add up several readings (oversampling) against choosen reference in sleep mode to denoise
// max samples: 64
uint16_t ADC_read(uint8_t port, uint8_t reference, uint8_t samples) {
uint16_t result = 0; // result
ADCSRA |= (1<<ADEN) | (1<<ADIF); // enable ADC, turn off any pending interrupt
ADMUX = (port & 0x0f) | reference; // set input channel and reference
if(reference || (port==AVBG)) _delay_ms(2); // wait 2ms to settle if Vref is used
set_sleep_mode(SLEEP_MODE_ADC); // sleep during sample for noise reduction
for(; samples; samples--) { // get several samples
sleep_mode(); // go to sleep while taking ADC sample
while(ADCSRA & (1<<ADSC)); // make sure sampling is completed
result += ADC; // add them up
}
return result; // return value
}
// ADC interrupt service routine
EMPTY_INTERRUPT(ADC_vect); // nothing to be done here
// ===================================================================================
// Additional Functions
// ===================================================================================
// Check if button is pressed
uint8_t buttonPressed(void) {
uint16_t value = ADC_read(AP_NTC, REFVCC, 1);
return(value < NTCMIN);
}
// Check if NTC is connected
uint8_t NTCpresent(void) {
uint16_t value = ADC_read(AP_NTC, REFVCC, 1);
return( (value >= NTCMIN) && (value < 1020) );
}
// ===================================================================================
// Main Function
// ===================================================================================
// Text strings stored in program memory
const char StartScreen[] PROGMEM =
"-- TinyLoad v1.2 --"
"Turn poti full CCW, "
"connect the load and "
"press SET button. ";
const char WarnScreen[] PROGMEM =
"!!!!! WARNING !!!!!"
"You reached max power"
" or temperature ! "
"!!! DECREASE LOAD !!!";
// Main function
int main(void) {
// Local variables
uint16_t vcc, vref2, onevolt, twovolt, rawCheck, temp;
float rawVoltage, rawCurrent, voltage, current, power, resistance;
float capacity = 0;
float energy = 0;
uint8_t primescreen = 1;
uint8_t warnscreen;
uint8_t lastbutton;
uint32_t lastmillis, nowmillis, interval;
// Setup
pinOutput(PIN_FAN); // set output pins
pinDisable(PIN_NTC); // disable digital input buffer
pinDisable(PIN_VOLTAGE); // disable digital input buffer
pinDisable(PIN_CURRENT); // disable digital input buffer
MIL_init(); // setup millis counter
ADC_init(); // setup ADC
OLED_init(); // prepare and start OLED
sei(); // enable global interrupts
// Calibrate internal 2.56V reference
vref2 = ADC_read(AVBG, REF2V56, 64); // read internal bandgap against 2.56V reference
vref2 = (uint32_t)72019200 / vref2; // calculate Vref2 in mV; 72019200 = 64*1023*1100
// Check if something is connected to the load
OLED_clearScreen();
OLED_setCursor(0,0);
OLED_printPrg(StartScreen);
while( (!buttonPressed()) && (ADC_read(AP_CURRENT, REF1V1, 1) < 10) );
// Init some variables;
lastmillis = MIL_read();
lastbutton = 1;
// Loop
while(1) {
vcc = ADC_read(AVBG, REFVCC, 64); // read internal bandgap against Vcc with 64 samples
vcc = (uint32_t)72019200 / vcc; // calculate Vcc in mV; 1125300 = 64*1023*1100
onevolt = (uint32_t)1125300 / vcc; // calculate ADC-value for 1.1V
twovolt = (uint32_t)vref2 * 1023 / vcc; // calculate ADC-value for 2.56V (calibrated)
// Read and calculate voltage in V
rawCheck = ADC_read(AP_VOLTAGE, REFVCC, 1); // get ADC-value for voltage reading
if (rawCheck < onevolt) { // check possibility of reading against 1.1V reference
rawVoltage = ADC_read(AP_VOLTAGE, REF1V1, 64); // read raw voltage against 1.1V reference
voltage = rawVoltage * 1100 / UCONV * ULCAL; // calculate real voltage value
}
else if (rawCheck < twovolt) { // check possibility of reading against 2.56V reference
rawVoltage = ADC_read(AP_VOLTAGE, REF2V56, 64); // read raw voltage against 2.56V reference
voltage = rawVoltage * vref2 / UCONV * ULCAL; // calculate real voltage value
}
else {
rawVoltage = ADC_read(AP_VOLTAGE, REFVCC, 64); // read raw voltage against vcc
voltage = rawVoltage * vcc / UCONV * ULCAL; // calculate real voltage value
}
// Read and calculate current in A
rawCheck = ADC_read(AP_CURRENT, REFVCC, 1); // get ADC-value for current reading
if(rawCheck < onevolt) { // check possibility of reading against 1.1V reference
rawCurrent = ADC_read(AP_CURRENT, REF1V1, 64); // read raw current against 1.1V reference
current = rawCurrent * 1100 / ICONV * ILCAL; // calculate real current value
}
else if(rawCheck < twovolt) { // check possibility of reading against 2.56V reference
rawCurrent = ADC_read(AP_CURRENT, REF2V56, 64); // read raw current against 2.56V reference
current = rawCurrent * vref2 / ICONV * ILCAL; // calculate real current value
}
else {
rawCurrent = ADC_read(AP_CURRENT, REFVCC, 64); // read raw current against vcc
current = rawCurrent * vcc / ICONV * ILCAL; // calculate real current value
}
// Calculate power and resistance
power = voltage * current; // calculate power in W
if(current > 0) resistance = voltage / current; // calculate resistance in Ohm
else resistance = 9999; // 9999 if no current
if(resistance > 9999) resistance = 9999; // 9999 is max displayed value
// Calculate energy/capacity in mWh and mAh
nowmillis = MIL_read();
interval = nowmillis - lastmillis; // calculate time interval
lastmillis = nowmillis;
energy += power * interval / 3600; // calculate mWh
capacity += current * interval / 3600; // calculate mAh
// Turn on fan if needed
temp = ADC_read(AP_NTC, REFVCC, 1);
if( (power > 8) || ( (temp >= NTCMIN) && (temp < NTCFAN) ) ) pinHigh(PIN_FAN);
else pinLow(PIN_FAN);
// Check limits
warnscreen = ( (power > MAXPOWER) || ( (temp >= NTCMIN) && (temp < NTCHOT) ) );
// Check button
if (!lastbutton && buttonPressed()) primescreen = !primescreen;
lastbutton = buttonPressed();
// Display values on the oled
OLED_setCursor(0,0);
if(warnscreen) OLED_printPrg(WarnScreen);
else {
OLED_printPrg(PSTR("Voltage: ")); OLED_printValue(voltage); OLED_printPrg(PSTR(" V"));
OLED_printPrg(PSTR("Current: ")); OLED_printValue(current); OLED_printPrg(PSTR(" A"));
if(primescreen) {
OLED_printPrg(PSTR("Power: ")); OLED_printValue(power); OLED_printPrg(PSTR(" W"));
OLED_printPrg(PSTR("Resistance:")); OLED_printValue(resistance); OLED_printPrg(PSTR(" O"));
}
else {
OLED_printPrg(PSTR("Energy: ")); OLED_printValue(energy); OLED_printPrg(PSTR(" mWh"));
OLED_printPrg(PSTR("Charge: ")); OLED_printValue(capacity); OLED_printPrg(PSTR(" mAh"));
}
}
_delay_ms(50);
}
}
Hahó! Már írtam, nem akarod megnézni a not connected lábra miért megy ellenállás?
Keress egy kész power bank panelt, ami tud usbc PD-t és egy kábelt ami triggereli a 20V-ot. Bontott vegyes celláknál ha nulláról építed legalább egy passzív balancer illene, mert nem ugyanúgy fognak merülni. Illetve kapacitást be kell mérd minden cellánál, hogy legalább nagyjából azonosak legyenek a tagok.
De ez messze a legjobb, mindent tud, balanszol, tölt, feszt kijelez, hővédelem meg mindenféle töltés mód.
Bővebben: Link
USB C PD triggeres kábel meg filléres és kapható mindenféle dc jackkel is. A hozzászólás módosítva: Júl 27, 2023
A not connected lábra van valami kötve neki, ha jó a rajza és gyártó pinoutnál kiemeli arra nem szabad semmit kötni.
Idézet: „(not included)”
Erre nem is figyeltem, hogy csak egy üres tok.
Nincs benne:
Idézet: „Battery: 6x 18650(not included)”
Mondjuk így nem is hazudnak, mert képes 900Ah leadni, ha olyan aksit tesznek bele. Az hogy ilyen termék nincs a piacon arról az eladó nem tehet.
Szia!
Egy igen jó példa a Kínaiaknak ezen fajta hozzá állásához:
Power bank 900000 mAh
Azaz 900Ah . Savas autó akku ból tegyél egymás mellé átlagos 45Ah -s ból 20darabot....
A részletes leírásban viszont ott van a kimeneti paraméter: Max. 5V 2A A hozzászólás módosítva: Júl 24, 2023
Szerintem igazad van. Egyszer már kitárgyaltuk a kérdést mágneskapcsolókra vonatkozóan, de szerintem ugyanez igaz szelepekre is. Röviden: Az AC és DC között nem csak a tekercs menetszámában és huzalvastagságban van különbség, hanem konstrukcióban (maga a vasmag is más lehet, tartalmazva a rövidrezárt menetet, többek között) is.
Idézet: „The working power of the AC relay is AC, and the working power of the DC relay is DC. The coil diameter of the AC relay is thicker and the number of turns is less, and the coil diameter of the DC relay has more turns than the thin wire diameter. The core of the AC relay has a short-circuit ring, and the DC does not. The cores of AC relays are mostly E-shaped, and the DC cores are cylindrical. The AC coil will generate heat due to eddy current and hysteresis loss in the iron core, so the coil has a skeleton to isolate the iron core from the coil, and the coil is made into a short and thick chunky type to dissipate heat from the coil and the iron core.
Most of the DC coils are thin and tall without a skeleton, so that the coil and the iron core are in direct contact with each other to facilitate heat dissipation. As far as the heating of the coil and the iron core is concerned, in the AC electromagnetic system, the iron core is a heating component, and there is a large gap between the coil and the coil, so as not to transmit heat to the coil, and the shape of the coil is short and thick, which is convenient for the iron core to dissipate heat; DC electromagnetic In the system, the coil is a heating component, there is no gap between it and the iron core, the iron core is used for heat dissipation, and the coil shape is slender, which is convenient for the coil itself to dissipate heat.”
Most csak ezt találtam, de talán pont elég.
Ha szerintem csak egy darab kell, és nincs bontott, akkor dugasztápot neki...
Szeretném felhívni szíves figyelmedet az ST Microelectronics AN4566 Extending the DAC performance of STM32 microcontrollers című "alkalmazási mintapéldájára".
A 2020. december 17-i és 2021. január 22-i előadásaimban bemutattam, hogy hogyan lehet az STM32F446RE mikrovezérlőjével DMA segítségével táblázattal adott adatokat kiküldeni szimultán két DAC csatornán. Engem a sebesség nem izgatott, tehát Timer6-tal ütemezett kiküldést kellene "áthangolni". A hozzászólásom elején említett iromány reményeim szerint űtbaigazítást ad, hogy melyik STM32 mikrovezérlőből mit és hogyan lehet kicsiholni (a sebességet illetően).
Megnéztem. Időzítő az nincs benne, de más időhúzó dolog az rendesen van benne:
void IRAM_ATTR __dacWrite(uint8_t pin, uint8_t value)
{
if(pin < 25 || pin > 26){
return;//not dac pin
}
pinMode(pin, ANALOG);
uint8_t channel = pin - 25;
//Disable Tone
CLEAR_PERI_REG_MASK(SENS_SAR_DAC_CTRL1_REG, SENS_SW_TONE_EN);
if (channel) {
//Disable Channel Tone
CLEAR_PERI_REG_MASK(SENS_SAR_DAC_CTRL2_REG, SENS_DAC_CW_EN2_M);
//Set the Dac value
SET_PERI_REG_BITS(RTC_IO_PAD_DAC2_REG, RTC_IO_PDAC2_DAC, value, RTC_IO_PDAC2_DAC_S); //dac_output
//Channel output enable
SET_PERI_REG_MASK(RTC_IO_PAD_DAC2_REG, RTC_IO_PDAC2_XPD_DAC | RTC_IO_PDAC2_DAC_XPD_FORCE);
} else {
//Disable Channel Tone
CLEAR_PERI_REG_MASK(SENS_SAR_DAC_CTRL2_REG, SENS_DAC_CW_EN1_M);
//Set the Dac value
SET_PERI_REG_BITS(RTC_IO_PAD_DAC1_REG, RTC_IO_PDAC1_DAC, value, RTC_IO_PDAC1_DAC_S); //dac_output
//Channel output enable
SET_PERI_REG_MASK(RTC_IO_PAD_DAC1_REG, RTC_IO_PDAC1_XPD_DAC | RTC_IO_PDAC1_DAC_XPD_FORCE);
}
}
extern void dacWrite(uint8_t pin, uint8_t value) __attribute__ ((weak, alias("__dacWrite")));
Ez ugye minden alkalommal meghívja a pinMode függvényt, amiben ez van:
extern void IRAM_ATTR __pinMode(uint8_t pin, uint8_t mode)
{
if(!digitalPinIsValid(pin)) {
return;
}
uint32_t rtc_reg = rtc_gpio_desc[pin].reg;
if(mode == ANALOG) {
if(!rtc_reg) {
return;//not rtc pin
}
//lock rtc
uint32_t reg_val = ESP_REG(rtc_reg);
if(reg_val & rtc_gpio_desc[pin].mux){
return;//already in adc mode
}
reg_val &= ~(
(RTC_IO_TOUCH_PAD1_FUN_SEL_V << rtc_gpio_desc[pin].func)
|rtc_gpio_desc[pin].ie
|rtc_gpio_desc[pin].pullup
|rtc_gpio_desc[pin].pulldown);
ESP_REG(RTC_GPIO_ENABLE_W1TC_REG) = (1 << (rtc_gpio_desc[pin].rtc_num + RTC_GPIO_ENABLE_W1TC_S));
ESP_REG(rtc_reg) = reg_val | rtc_gpio_desc[pin].mux;
//unlock rtc
ESP_REG (DR_REG_IO_MUX_BASE + esp32_gpioMux [pin ]. reg) = ((uint32_t )2 << MCU_SEL_S ) | ((uint32_t )2 << FUN_DRV_S ) | FUN_IE;
return;
}
//RTC pins PULL settings
if(rtc_reg) {
//lock rtc
ESP_REG(rtc_reg) = ESP_REG(rtc_reg) & ~(rtc_gpio_desc[pin].mux);
if(mode & PULLUP) {
ESP_REG(rtc_reg) = (ESP_REG(rtc_reg) | rtc_gpio_desc[pin].pullup) & ~(rtc_gpio_desc[pin].pulldown);
} else if(mode & PULLDOWN) {
ESP_REG(rtc_reg) = (ESP_REG(rtc_reg) | rtc_gpio_desc[pin].pulldown) & ~(rtc_gpio_desc[pin].pullup);
} else {
ESP_REG(rtc_reg) = ESP_REG(rtc_reg) & ~(rtc_gpio_desc[pin].pullup | rtc_gpio_desc[pin].pulldown);
}
//unlock rtc
}
uint32_t pinFunction = 0, pinControl = 0;
//lock gpio
if(mode & INPUT) {
if(pin < 32) {
GPIO.enable_w1tc = ((uint32_t)1 << pin);
} else {
GPIO.enable1_w1tc.val = ((uint32_t)1 << (pin - 32));
}
} else if(mode & OUTPUT) {
if(pin > 33){
//unlock gpio
return;//pins above 33 can be only inputs
} else if(pin < 32) {
GPIO.enable_w1ts = ((uint32_t)1 << pin);
} else {
GPIO.enable1_w1ts.val = ((uint32_t)1 << (pin - 32));
}
}
if(mode & PULLUP) {
pinFunction |= FUN_PU;
} else if(mode & PULLDOWN) {
pinFunction |= FUN_PD;
}
pinFunction |= ((uint32_t)2 << FUN_DRV_S);//what are the drivers?
pinFunction |= FUN_IE;//input enable but required for output as well?
if(mode & (INPUT | OUTPUT)) {
pinFunction |= ((uint32_t)2 << MCU_SEL_S);
} else if(mode == SPECIAL) {
pinFunction |= ((uint32_t)(((pin)==1||(pin)==3)?0:1) << MCU_SEL_S);
} else {
pinFunction |= ((uint32_t)(mode >> 5) << MCU_SEL_S);
}
ESP_REG (DR_REG_IO_MUX_BASE + esp32_gpioMux [pin ]. reg) = pinFunction;
if(mode & OPEN_DRAIN) {
pinControl = (1 << GPIO_PIN0_PAD_DRIVER_S);
}
GPIO.pin[pin].val = pinControl;
//unlock gpio
}
extern void pinMode(uint8_t pin, uint8_t mode) __attribute__ ((weak, alias("__pinMode")));
Ezek után ne csodálkozz hogy ilyen lassú.
Idézet: „Hát, ha nem kell regiszter szinten belenyúlni, akkor miért nem megy?”
Mert rosszul van megírva program!
Idézet: „Nem elég output-ra állítani, azt is elrontom?”
Nem mind1 hogy és mikor állítod kimenetre! Nem vagyok programozás guru, de a mostani felállásban van rá esély, hogy az adott pinek bemenetek legyenek!
Ezért javasoltam, hogy az szükséges kimeneteket már a setup részben definiáld! Úgyis csak a DAC létra van ezekre kötve (gondolom)
Idézet: „define-okkal megadott hexa értékek csak számok nekem. Gondolom valamelyik regisztereknek ad megfelelő értékeket mindegyik.”
Ez így van! Az adott hardver rész, jelen esetben az IO-k beállításait tartalmazza.
Idézet: „meg kell-e pull down, vagy sem, lehet-e egyáltalán vagy sem. Én nem tudom, ezért kérdezem.”
Jó lenne ha ismernéd µC-k "I/O Pin Equivalent Schematic"-ját, magyarul az egyszerűsített kapcsolási rajzát! És értenél az elektrotechnikához, akkor már tudnál mindent!
ESP-hez nem találtam, de AtMega-hoz igen:
https://www.arnabkumardas.com/arduino-tutorial/gpio-register-description/
A DAC létra pontos működésékez kis impedanciás (max. pár ohm) logikai 1, vagy 0 kell! Ezt fel-, vagy lehúzó ellenállásokkal, "Open Drain" kimenettel nem lehet megcsinálni!
A fel- vagy lehúzó ellenállások használatának csak akkor van értelme, ha az adott pin-t bemenetként használjuk!
Köszi a választ, de még nem világos ez. Arduino, DSPIC,PIC -ben már sokat olvastam, meg használom is, de tudom, hogy sok időmbe telt, mire kibogarásztam a felépítését, ezért fordulok ide, mert aki sokat használta az ESP32-t az gyorsabban tudja kihámozni a megoldást.
A dokumentációban(727 oldalasban) a 76. oldalon ezt találtam a
"register 4.34. IO_MUX_x_REG (x: GPIO0GPIO39) (0x10+4*x)"
fejezetben:
Idézet: „FUN_WPD Pull-down enable of the pad. 1: internal pull-down enabled, 0: internal pull-down disabled. GPIO pins 34-39 are input-only. These pins do not feature an output driver or internal pullup/pull-down circuitry, therefore, their FUN_WPD is always 0. (R/W)”
Szóval elképzelhető, hogy az adott pin-re ezekel kell beállítani? Szóval mondjuk a GPIO12-nek ezen regiszterében a FUN_WPU -t nullára, míg a FUN_WPD-t 1 re kell állítani?
Mert ha jól értem, akkor a 34-39 pinre nem vonatkozik ez a driver. Ha lehúzom nullára az output lábakat a beéptett ellenállással, majd írok rá szoftverből, akkor megjelenik a logikai 3.3V?
Ez nem ezt csinálja?
És alapból 0 a regiszter értéke, azaz nem használ sem le, sem felhúzó ellenállást. A Z állapot nekem nem jó szerintem, mert az éppen logikai 0-n lévő lábaknak a földön kell lenniük.
Melyik regisztert kell még néznem, hogy egy adott pin output legyen?
Köszönöm a türelmeteket! A hozzászólás módosítva: Júl 3, 2023
A program tele van serial.print-el, arra voltam kiváncsi pontosan miket ír ki...
próbáld így:
https:// esp32tutorials.com/ esp32-sntp-esp-idf-synchronize-time-ntp/
time_t now;
struct tm timeinfo;
time(&now);
localtime_r(&now, &timeinfo);
// Is time set? If not, tm_year will be (1970 - 1900).
if (timeinfo.tm_year < (2016 - 1900)) {
ESP_LOGI(TAG, "Time is not set yet. Connecting to WiFi and getting time over NTP.");
obtain_time();
// update 'now' variable with current time
time(&now);
}
...............
illetve 2016 helyett pl 2022 A hozzászólás módosítva: Jún 25, 2023
Sziasztok!
Olyan kérdésem lenne, hogy milyen alternatív email szolgáltatót ajánlanátok az alábbi szempontok alapján:
-ne legyen gmail
-nekem nem igen kell gazdag feature szett, extra funkciók (pl naptár, bigfile küldés stb.) azért nem baj ha valamennyire biztonságos
-ingyenes
opcionálisan: nem magyar domain (van olyan játék ami nem megy magyar domain-nel)
Természetesen van több email címem több szolgáltatónál, van amit kizárólag hivatalos helyeken használok (nav, ük, bank) van amit netes rendelésre másra nem, van amit céges ügyek intézésére. Gmailesem is van erre keresek alternatívát valójában.
Köszönöm
Azt oldja meg a kondenzátor( bank).
Sajnos erre pont annyira van konkrét érték, mint az üzemi kondenzátorra.
Én prakitkusan megsergetném és terhelném.
De ugye a kérdező nem akar sok kondenzátort venni próbálkozáshoz.
Olyan képletet szeretne hallani, hogy például 15 nF x kW / MHz.
Itt van a levezetése öt oldalban. A hozzászólás módosítva: Jún 17, 2023
|
|