Posts mit dem Label make werden angezeigt. Alle Posts anzeigen
Posts mit dem Label make werden angezeigt. Alle Posts anzeigen

2017-01-07

Wifi Scanner with ESP8266 + TFT ST7735B (NodeMCU)

After successful connect the ESP8266 with the ST7735 display I want to do more than the demo - so here comes a Wifi Scanner.

Same hardware setup as in the previous blog post.



And here is the source code:

2016-04-10

ESP-01 + DHT22: Send data to influxdb

My first ESP-01 "system" is running now. It measures temperature and humidity using a DHT22 every 20 seconds and send the data to an influxdb database.


The influxdb is then used by a Grafana instance where I define a panel for the temperature and humidity. Here are the first measurements:


Looks like there where a glitch at about 12:30 - I will have a look how often this happen.
And here is the corresponding ESP code:

2016-04-07

First Steps with ESP-01 on OS X El Capitan - Part 2

In part 1 I described how I setup my my environment. In this part I will show my first lua programming steps with the ESP8266 using the Lua based NodeMCU firmware.

First I create an init script (init.lua). This will be loaded by the firmware after each boot/restart.
As last step in the boot/restart process the firmware loads and executes the script init.lua (you can see a corresponding error message in the last screenshot in part 1).
It is recommended to provide an opportunity to interrupt the execution of init.lua to be able to change anything. Otherwise it may happen e.g. if your code contains a fatal error which cause a reboot that you are unable to deactivate/fix the code - and finally have to reflash the firmware to be break the loop.

I'm looking around an found a post about Methods of Interrupting init.lua during boot. My init.lua code based mainly on the ideas described there. But here it is:
  1. it calls firmwareInfo() to output information about the firmware. For the moment it just inform if it is a FLOAT or INTEGER version
  2. after a delay of BootTimeout ms (to give the NodeMCU some time to initialize it self) init() is called
  3. in init() the serial port is initialized and configured to watch for a transmitted ENTER key
  4. if an ENTER is received the function abort() is called, which set the abortFlag to true.
  5. After AbortTimeoutms startup() is called. There the abortFlag is checked and the startup is canceled or executed by trying to load and execute 'user.lua'
The output of such a run without interrupt is shown below:


Next step was to wrote a script to read out a DHT22 sensor. The user_dht22.lua script shown below reads temperature and humidity every 2 sec and prints both values. Depending on the used firmware the output is generated using different format and in case of integer also further values.

Output running the script

2016-03-29

First Steps with ESP-01 on OS X El Capitan

Environment: MacBook Pro Mid 2010, OS X El Capitan 10.11.4
ESP-01 Module + Simple DIY Dev Board (based on this)

  1. Install esptool to backup/change/update ESP8266 firmware
    1. Clone git repository https://github.com/themadinventor/esptool
      $ git clone https://github.com/themadinventor/esptool.git
      Cloning into 'esptool'...
      ...
      
    2. cd esptool
    3. run install routine
      $ sudo python setup.py install
      Password:
      running install
      ...
      Installing esptool.py script to /usr/local/bin
      
  2. Connect ESP8266 ESP-01 Board via CH340G Converter to MBP
    1. Install CH340G driver (WCH provides a signed driver)
    2. Identify the tty port
      $ ls /dev/tty.w*
      /dev/tty.wchusbserial410
    3. activate ESP boot loader (needs to be repeat before each esptool command) by reset ESP and pull GPIO 0 to GND meanwhile.
    4. Check communication
      $ esptool.py --port /dev/tty.wchusbserial410 --baud 115200 flash_id
      Connecting...
      Manufacturer: c8
      Device: 4013
      
      $ esptool.py --port /dev/tty.wchusbserial410 --baud 115200 chip_id
      Connecting...
      Chip ID: 0x009b82bc
      
      
  3. (optional) make a backup of the original firmware - takes about 48sec
    $ time esptool.py --port /dev/tty.wchusbserial410 --baud 115200 
    read_flash 0x000 524288 fw_backup.bin
    Connecting...
    Please wait...
    
    real 0m47.721s
    user 0m0.762s
    sys 0m0.344s
    
    (Note: ESP12-E has a bigger flash - 4MB = 4194304)
  4. Flash alternative firmware - I want to give NodeMCU firmware a try
    1. Use standard NodeMCU firmware (download from github) or
    2. Config your own customized NodeMCU firmware 
    3. Get the download links (integer and float version) about 2min later (you can also use the preconfigured
    4. Flash it to the ESP-01 (I start with the integer version)
      $ time esptool.py --port /dev/tty.wchusbserial410 --baud 115200 
      write_flash 0x00000 nodemcu-master-9-modules-2016-03-29-19-22-38-integer.bin
      Connecting...
      Erasing flash...
      Took 1.22s to erase flash block
      Wrote 403456 bytes at 0x00000000 in 48.2 seconds (66.9 kbit/s)...
      
      Leaving...
      
      real 0m50.195s
      user 0m0.383s
      sys 0m0.126s
      
  5. Connect to ESP. I use SerialTools (AppStore Link) - Note: Baud Rate is 76800

2015-10-23

Magic-Mirror: OpenWeatherMap Fix und TimeStamp bei den News

Wegen einer Änderung der API bei OpenWeatherMap bedurfte mein MagicMirror einer Wartung. Zum Glück waren die Änderungen gering: Beschrieben sind sie schon an anderer Stelle, daher hier nur ein Link auf eine Beschreibung in Deutsch und beim Magic-Mirror Autor.

Daneben habe ich die Gelegenheit gleich genutzt, um die Anzeige der News um die Angabe der Veröffentlichungszeit zu ergänzen. Das ganze sieht jetzt so aus:


Das GitHub Projekt ist entsprechend aktualisiert - wer will ... bitte schön.

2015-05-01

Raspberry Pi - PIR Sensor

For my next project I want to detect movements and switch on/off something (or finally the monitor). Here is the experimental setup

  • Raspberry Pi Rev2.0
  • PIR sensor (connected to GPIO 4 + 17) - I use two pins because then I can assign a rising and falling edge event handler (see the code)
  • 2x LED (connected to GPIO 24 + 25)
  • 2x 100Ohm Resistor
  • (also on the board but not yet in use: temperature sensor)



and the corresponding source code:
To start the script at boot time I use the following initd script:

2015-03-15

Ring Clock

At end of 2014 I had enough time to finish my Ring Clock project (or at least push some steps forward).







I used a picture frame as casing. The passepartout serves as rack for the led ring. I have put a circle of red carton in the middle of the led ring. The carton masks the display board and contains a hole for the light sensor. Two thin carton frames act as spacer to put some distance between the glas plate and the led ring. A sheet of sandwich paper is used as diffusor.




The electronic part is assembled of a Arduino Pro Mini (Watterott), a DCF77 receiver (Pollin), a DS1307 RTC module (ebay), a DS18B20 temperature sensor (ebay), a light sensor (GL5528), a 8 digit display - using 8 old VQB18C modules and a driver (ebay) - and a 60 RGB led ring (Watterott).





The source code and further information can be found here.

2013-10-26

LED RGB Strip with Web Interface - Update

After some iterations (I hope) I reach a "done" state. The current version contains the following features:
  • Web page content depends on current mode - different pages when strip is on or off 
  • Web page to configure some runtime values (see right screen shot above)
  • Fav-Icon(s)
I mounted the LED strip on backsite of a strip of wood and mounted it on the wall with magnets. On the front side I mounted the PIR module.
 

Here you can see the mounted wooden strip in our hallway.

For the electronic part of the project please look at the project site.

2013-07-26

LED RGB Strip with Web Interface

Project site

Current issue: As you can see in the video there is a small delay between clicking the button and changing the light. This only appears when using a mobile device, on my mac the delay disappears. Any hint is welcome.

2013-07-25

Wattuino - erste Schritte

Bei Watterott gibt es einen kleinen Arduino Clone: Wattuino. (Im Bild schon bestückt mit Stiftleisten.)


Für die Entwicklung/Programmierung mit der Arduino Umgebung wird noch ein Programmieradapter benötigt, z.B. FTDI-Breakout. Beim FTDI-Breakout handelt es sich um einen USB-Seriell Wandler, damit kann der Wattuino (fast) wie ein normaler Arduino in der IDE verwendet werden. Update: Ggf. muss noch ein FTDI Treiber installiert werden.


Die Verwendung in der Arduino Entwicklungsumgebung gestaltet sich mit der genannten Kombination denkbar einfach.
  • Board: Arduino Pro or Pro Mini
  • Serial Port: /dev/tty.usbserialA1017RLQ (Nummer kann ggf. variieren)


Und das war es auch schon. Die ersten Tests mit den Arduino Beispielen "Blink" und "ReadASCIIString" liefen bei mir dann auf Anhieb.




2012-12-22

AVR NET-IO: Receive UDP packets

Some month ago I post an article about sending UDP - now it's time to write about receiving UDP.

Again my equipment is:
  • Pollin AVR NETIO Board
  • Arduino 1.0.3
  • avr-netino (Project)

Patch tcpip.cpp

To enable UDP receiving a patch of the tcpip.cpp file is needed. The patched file can be found here. You need to overwrite the original file libraries/EtherCard/tcpip.cpp with the patched one.

Arduino program

Arduino program to receive UDP packets:

Example script to send UDP

Here is a small example how to send UDP packets to avr-netio board:

2012-07-08

AVR NET-IO: UDP senden / Send UDP packages

Demo für das Senden von UDP Paketen mit
  • Pollin AVR NETIO Board
  • Arduino 1.0.3
  • avr-netino (Project)

A short example how to send UDP packages with
  • Pollin AVR NETIO Board
  • Arduino 1.0.3
  • avr-netino (Project)

2012-06-30

Macro LED-Ringlicht

Für unser Tamron AF 90mm 2,8 Di Macro ist ein LED-Ringlicht entstanden.



Der Aufbau ist einfach gestaltet:


versorgt.



Bauteile:


  • 50 Stück SMD LEDs WEISS, Bauform PLCC-2 3528 - 3,2mm x 2,8mm x 1,9mm, - ULTRAHELL - max. 2850mcd - ABSTRAHLWINKEL 120° -, (ebay 8,90 EUR)
  • Filter Ring Adapter 55mm-77mm (ebay 4,79 EUR)
  • 5A LM2587 DC-DC Step up Boost Adjustable Power Supply Module 3-30v 4-35v (7,80 EUR)
  • sonst noch: 9V Block, Schalter, Gehäuse
Auf dem gelieferten Fertigmodul des Step-Up Wandlers musste ich den TrimmPoti und Ausgangselko tauschen, um die Ausgangsspannung auf 40V erhöhen zu können. 
Die Vorwiderstände haben eine Wert von 56Ohm.

Ergebnis/Anwendung

Lichtkegel des Ringlichts

30sec. f/32 ISO3200 (ohne Ringlicht)

1/25sec. f/32 ISO3200 (mit Ringlicht)

2012-02-12

AVRISPV2 / STK500v2 und Arduino 1.0 unter OSX

Seit kurzem habe ich einen STK500v2 Clone von Sure Electronic (bei ebay beworben als: "Mini ATMEL AVR ATMEGA STK500 USB Programmer ISP AVRISP").


Um den Programmer mit Arduino 1.0 unter OSX betreiben zu können, waren folgende Anpassungen nötig:

  1. Treiber installieren
    Auf der Webseite von Sure Electronics kann man zwar auch ein Treiberpaket downloaden, der enthaltene Treiber hat aber ein Datum von 2006. Ich habe daher diesen Treiber installiert.
  2. Den Programmer in Arduino bekannt machen
    Dazu habe ich in der Datei programmer.txt (Bestandteil von Arduino) die folgenden Zeilen eintragen:

  3. Anschliessend konnte ich dann in Arduino sowohl den Programmer als auch das zugehörige serielle Interface auswählen.

2012-01-28

PICkit3 mit MCU Universal ZIF socket

Schon vor ein paar Wochen (oder sind es gar schon Monate) habe ich mir ein PICkit3 mit ZIF Sockel Platine bei SureElectronics bestellt. Heute wollte ich das Teil in Betrieb nehmen (unter Win7 32bit).


Der erste Versuch mit der PICkit 3 Stand Alone Programmer App schlug allerdings fehl. Starten lies sich das Programm solange der Programmer nicht angeschlossen war noch. Nach dem Anschluss und "Check Communication" kam es aber wiederholbar zu einer Fehlermeldung (irgendwas mit Array Grenzen werden überschritten - genauer kann ich es leider nicht mehr angeben). Beim Starten mit bereits angeschlossenen Programmer, kam lediglich eine Windows-Meldung der Art "Es wurde ein Problem festgestellt ..."

Als nächstes habe ich dann MPLAB 8.83 runtergeladen. Hier wurde der Programmer immerhin erkannt und die Notwendigkeit eines Firmware Updates gemeldet. Dafür müssen anscheinend zwei Teile geladen werden (AP und RS). AP wurde dann auch erfolgreich gedownloaded und übertragen, bei RS ging es dann aber nicht weiter.
Nach ein paar Minuten habe ich dann beherzt den Programmer rausgezogen, wieder neu eingesteckt und das Spiel ging von vorn los, dass ganze musste ich ca. 3x wiederholen und dann war die Firmware aktualisiert.
MPLAB meldet jetzt bei anstecken und auswählen des Programmers:

PICkit 3 detected
Connecting to PICkit 3...
Running self test...
Self test completed
Firmware Suite Version...... 01.26.92
Firmware type......................PIC18F
PICkit 3 Connected.
Ein anschließender Test mit dem Stand Alone Programmer ergab schließlich, dass der jetzt auch läuft.

Eine Anmerkung noch zum ZIF Sockel: Da die Bedienung der Sockelhebel mit der Deckplatte schwierig ist, habe ich diese kurzer Hand abgeschraubt. Da die Pin Nummerierung an den Sockeln nur schwer lesbar ist, muss man beim Einsetzen der Chips besonders sorgfältig sein. Pin 1 ist immer auf der gegenüberliegenden Ecke des Hebels. (Schaltplan der Platine)


2011-02-19

Ampel V5

Meine Nichte (4) äußerte zu Weihnachten den Wunsch nach einer Ampel. (Wie sie darauf kam ist meiner Schwester und mir ein Rätsel - meine bisherigen Exemplare hat sie meines Wissens nach bisher nicht gesehen.)
Entstanden ist wiederum eine neue modifizierte Variante mit folgenden Features:

  • reduzierter Bauteilaufwand (kein Quarz, kein Spannungsregler)
  • Ein-Taster-Bedienung - Ein/Aus, Tag/Nachtmodus
  • automatische Abschaltung nach ca. 5 min

Und so sieht die Ampel aus:



Code und Schaltplan werde ich bei Gelegenheit noch hier ablegen.

USB4all unter OSX 10.6

USB4all stellt ein USB Interface für die Ansteuerung von Hardware bereit.

Im Download-Paket auf der Seite befindet u.a. sich ein Archiv mit Beispielen zur Ansteuerung von USB4all unter Linux (usb4all-linux-v103.tgz). Um die Beispiele auf OSX zu übersetzen, benötigt man die MacPorts libusb und libusb-compat. Diese installiert man mit:
sudo port install libusb libusb-compat
In den Beispielen muss dann in den Makefiles die Variable LIB um die Pfade zu usb.h und libusb ergänzt werden (-I und -L Parameter):
LIB="-I/opt/local/include -L/opt/local/lib -lusb"

2010-11-02

Cylon Jack-O-Lantern

Als kurzfristiges Halloween Projekt haben wir uns ein Cylon Jack-O-Lantern vorgenommen. Die Idee haben wir von hier und hier. Allerdings haben wir eine andere Hardwarebasis gewählt (Microcontroller).

Die Hardware wurde aus 16 LEDs, einem Microcontroller (PIC 16F876A) sowie Widerstände, Quarz, Kondensatoren  am Samstag Nachmittag zusammengelötet. Als "Gehäuse" dient ein Plastikei einer Riesen-Kinderüberraschung (gut das ich sowas als potentielle Gehäuse aufhebe ;-).
Der einstellbare Widerstand sollte dazu dienen die Geschwindigkeit der Animation einzustellen - dieses Feature fiel aber dann der knappen Zeit zum Opfer.

Weiter ging es dann mit dem Schnitzen des Kürbis. Vorlagen oder Muster für einen Cylon-Kürbis finden sich im Netz genug, sodass wir hier nur nachahmen mußten. Wie wir finden ist uns das fürs erste Mal ganz gut gelungen.

Dann blieb nur noch das Programm für die Ansteuerung zu schreiben. Als Betriebsmodi haben wir implementiert: Wake-Up (Leuchtdioden werden von der Mitte aus aktiviert, wenn alle an sind, schalten sie kurz auf volle Helligkeit), Stand-By (Wandernder Leuchtpunkt mit einer LED) und Scan (Wandernder Leuchtpunkt mit 5 LED).


Der Quellcode ist nicht unser Glanzstück, aber es musste halt schnell gehen - und schließlich zählt das Ergebnis: Der Jack-O-Lantern konnte mit beginnender Dunkelheit in Betrieb genommen werden.

Wer das Projekt nachbauen will: Den Quellcode gibt es hier.

Für das nächste Jahr wollen wir das Projekt ausbauen: Bewegungsmelder, Sound, ... mal sehen was uns sonst noch einfällt.