ESP8266 - zasilanie to ważna sprawa

  • 49 Odpowiedzi
  • 42247 Wyświetleń

0 użytkowników i 1 Gość przegląda ten wątek.

Odp: ESP8266 - zasilanie to ważna sprawa
« Odpowiedź #45 dnia: Wrzesień 28, 2015, 05:27:53 pm »
Ja kiedy coś miało mieścić się do puszki to używałem zasilaczy 1W do diod LED np. https://www.maritex.com.pl/pl/zasilacze-stalopradowe-o-podwyzszonej-szczelnosci/PS-CC01-SLP01SS-i-16231-c-41243
Z małym obciążeniem mają na wyjściu napięcie około 4V.
W zasilaczach impulsowych napięcie czasem narasta powoli. Nie wszystkie urządzenia w takim przypadku wykonują poprawny reset.
Problemem może być też izolacja jeśli do ESP miałeś podłączone jakieś uziemione elementy.
« Ostatnia zmiana: Wrzesień 28, 2015, 05:51:28 pm wysłana przez Pawel2420 »
*

Offline Patriko

  • **** 441
  • 21
  • Nazwa i wersja ID: Darin/BleBox.eu
Odp: ESP8266 - zasilanie to ważna sprawa
« Odpowiedź #46 dnia: Wrzesień 28, 2015, 05:50:51 pm »
Zasilanie ESP to sprawa nietrywialna ale i nie niemożliwa. Na pewno zrezygnowałbym z podróbek ESP których pełno na allegro i sięgnął po zapasy producenta: http://espressif.com/en/products/wroom/ (to co jest na allegro jako ESP bodajże 13 to też podróbka). Jest dużo bardziej stabilne i ma prawidłowe filtrowanie + układ resetu. A to właśnie jest problem wspomniany przez Pawła. Szum przy starcie uniemożliwia kalibrację toru RF (a jest przeprowadzana zawsze przy włączaniu).

Co do zasilania to mieliśmy ten problem w modułach switchBox i shutterBox (będzie za kilka dni na forum). Najnowsza przetwornica w shutterBoxie ma mniej niż 1x1x1cm ale jej stworzenie i doprowadzenie do stanu w którym nadaje się do produkcji zajęło 2 jak nie 3 miesiące (zespołowi kilku elektroników którzy siedzą w zawodzie od lat i mają full wypas laboratorium) i pochłonęło równowartość średniej klasy samochodu więc nie jest łatwo.

Najbliżej wydaje mi się coś takiego: http://pl.farnell.com/vigortronix/vtx-214-001-103/ac-dc-conv-fixed-1-o-p-1w-3-3v/dp/2401019.

Pozdrawiam!~
Patryk
*

Offline kniazio

  • ** 25
  • 0
  • Nazwa i wersja ID: kniazio
Odp: ESP8266 - zasilanie to ważna sprawa
« Odpowiedź #47 dnia: Wrzesień 28, 2015, 06:11:51 pm »
To ja narazie chyba pozostane przy konwerterze UART
Dzieki za zainteresowanie
*

Offline kniazio

  • ** 25
  • 0
  • Nazwa i wersja ID: kniazio
Odp: ESP8266 - zasilanie to ważna sprawa
« Odpowiedź #48 dnia: Listopad 25, 2015, 05:32:44 pm »
Mam dziwny problem z czujnikiem dht11 na esp
Najnizsza temperture jaka mi pokazal to 1st
Teraz np jest -2 a on i tak pokazuje 1
init.lua
--     thingspeak.com client with sensor DHT11,DHT22
--    Tested with Lua NodeMCU 0.9.6 (nodemcu_float_0.9.6-dev_20150704.bin)
--    Minimal period for data send to api.thingspeak.com is 15s
--
   DEBUGPRINT = true -- true: enable debugg print, false: disable debugg print
--****************************************************************
   WRITEKEY="xxxxxxxxxxxx" -- set your thingspeak.com key
--****************************************************************
   ssid="xxxxxxxxxxxxx"    -- your router SSID
    pass="xxxxxxxxxx"   -- your router password
--****************************************************************
   pin=4   -- number of pin (GPIO0), where is DHTXX connected
   prs=60  -- period reading and sending sensors [s]
   wifi.setmode(wifi.STATION)
   wifi.sta.config(ssid,pass,1)

function debugprint(...)
   if DEBUGPRINT then
      print(...)
   end
end

--Read DHTXX sensor
function ReadDHT()
     status,temp,humi,temp_decimial,humi_decimial = dht.read(pin)
   if( status == dht.OK ) then
   debugprint("DHT Temperature:"..temp..";".."Humidity:"..humi)
   elseif( status == dht.ERROR_CHECKSUM ) then
   debugprint( "DHT Checksum error." );
   elseif( status == dht.ERROR_TIMEOUT ) then
   debugprint( "DHT Time out." );
   end
end

-- send data to https://api.thingspeak.com
function SendTS()
conn = net.createConnection(net.TCP, 0)
conn:connect(80,'api.thingspeak.com')   -- This row is good, but only for newer firmware
--conn:connect(80,'184.106.153.149')    -- This is worse, but it also works well with the older firmware.
conn:on("connection",
   function(conn) debugprint("Connection!")
   conn:send('GET /update?key='..WRITEKEY..
   '&headers=false'..
   '&field2='..humi..
   '&field3='..temp..
   ' HTTP/1.1\r\n'..
   'Host: api.thingspeak.com\r\nAccept: */*\r\nUser-Agent: Mozilla/4.0 (compatible; esp8266 Lua; Windows NT 5.1)\r\n\r\n')
   end)
conn:on("sent",
   function(conn)
   debugprint("Sent!")
      if DEBUGPRINT == false
      then
      conn:close()
      end
   end)
conn:on("receive",
   function(conn, payload)
   debugprint("Receive!")
   debugprint(payload)
   conn:close()
   end)
conn:on("disconnection",
   function(conn)
   debugprint("Disconnection!")
   end)
end

-- first reading sensors
  ReadDHT()
  SendTS()
-- Periodic reading of the sensor
tmr.alarm(0,prs*1000,1,
 function()
 if wifi.sta.getip()==nil
   then
   print("IP refresh")
   print("!!!!!!!!!!!!!!")
   node.restart()
   end
  ReadDHT()
  SendTS()
end)
dht11.lua
-- ***************************************************************************
-- DHT11 module for ESP8266 with nodeMCU
--
-- Written by Javier Yanez
-- but based on a script of Pigs Fly from ESP8266.com forum
--
-- MIT license, http://opensource.org/licenses/MIT
-- ***************************************************************************

local moduleName = ...
local M = {}
_G[moduleName] = M

local humidity
local temperature
local checksum
local checksumTest
local checko1
local checko2

function M.read(pin)
  humidity = 0
  temperature = 0
  checksum = 0
  checko1=0
  checko2=0
  -- Use Markus Gritsch trick to speed up read/write on GPIO
  gpio_read = gpio.read
  gpio_write = gpio.write

  bitStream = {}
  for j = 1, 40, 1 do
    bitStream[j] = 0
  end
  bitlength = 0

  -- Step 1:  send out start signal to DHT11
  gpio.mode(pin, gpio.OUTPUT)
  gpio.write(pin, gpio.HIGH)
  tmr.delay(100)
  gpio.write(pin, gpio.LOW)
  tmr.delay(20000)
  gpio.write(pin, gpio.HIGH)
  gpio.mode(pin, gpio.INPUT)

  -- Step 2:  DHT11 send response signal
  -- bus will always let up eventually, don't bother with timeout
  while (gpio_read(pin) == 0 ) do end
  c=0
  while (gpio_read(pin) == 1 and c < 100) do c = c + 1 end
  -- bus will always let up eventually, don't bother with timeout
  while (gpio_read(pin) == 0 ) do end
  c=0
  while (gpio_read(pin) == 1 and c < 100) do c = c + 1 end

  -- Step 3: DHT11 send data
  for j = 1, 40, 1 do
    while (gpio_read(pin) == 1 and bitlength < 10 ) do
      bitlength = bitlength + 1
    end
    bitStream[j] = bitlength
    bitlength = 0
    -- bus will always let up eventually, don't bother with timeout
    while (gpio_read(pin) == 0) do end
  end

  --DHT data acquired, process.
  for i = 1, 8, 1 do
    if(bitStream[i+0]>2)then
      humidity=humidity+2^(8-i)
    end
if(bitStream[i+8]>2)then
      checko1=checko1+2^(8-i)
    end
    if(bitStream[i+16]>2)then
      temperature=temperature+2^(8-i)
    end
    if(bitStream[i+24]>2)then
      checko2=checko2+2^(8-i)
end
    if (bitStream[i+32]>2)then
      checksum=checksum+2^(8-i)
    end
  end

  checksumTest=(humidity+checko1+temperature+checko2)%256

 -- convert to negative format
 --if temperature > 0x8000 then temperature = -(temperature - 0x8000)
 --end

  if checksum ~= checksumTest then
    humidity = -1
  end
end

function M.getTemperature()
  return temperature
end

function M.getHumidity()
  return humidity
end

return M
*

Offline kniazio

  • ** 25
  • 0
  • Nazwa i wersja ID: kniazio
Odp: ESP8266 - zasilanie to ważna sprawa
« Odpowiedź #49 dnia: Listopad 25, 2015, 09:32:43 pm »
Odpowiem sam sobie:)
Zapomnialem ze dht 11 ma zakres 0-50:)
Podmienilem na dht22 i jest OK
Sorry za zamieszanie