Raspbery Pi and HDMI2AV

hdmi2av

http://www.dx.com/p/hdmi-to-av-cvbs-l-r-video-converter-black-287673?r=89918554

I just got HDMI2AV converter from DX. I was annoyed buy noise coming from power supply on analog audio output from Raspberry Pi and decided to buy this little adapter and see what will happen. I’m more than pleased with result. My Raspberry Pi is now connected via HDMI cable to HDMI2AV adapter, analog video from this adapter is connected to my CRT TV 🙁 and analog audio to Sony STR-485DE amplifier. I even think that video quality is a bit better. Analog video out from RPi looks washed out compared to output from HDMI2AV adapter. Overall I’m quite pleased with this adapter and how well it performs. Only problem that I encountered is that at first it didn’t work. I thought that device is faulty but when I connected it to STB it worked. I than tried playing with RPi config settings and found that there is config_hdmi_boost setting that accepts values from 0-7. I tried with 5 and it worked. Beside that I added hdmi_group=1 and hdmi_mode=17 (576p 50 Hz). I tried other resolutions and it looks same but I’m guessing that 576p is more CPU/GPU friendly than 1080p and my PAL CRT TV is 768×576 or less.

Attiny13 PWM Candle

While ago I found project that emulates candle flame using attiny13 MCU and two colored LED (red/yellow) or alternately two separate LED’s. Project author used method of randomly turning on and off LED’s and it looked relatively OK but it was a bit hard for eyes. I decided to make it from scratch using PWM (Pulse wide modulation) that randomly changes light intensity instead of turning on and off completely LED’s. It resulted in much more realistic candle flame simulation. It’s handy for making romantic atmosphere without fear of setting fire 😉

Schematic

LED’s are connected through 100Ω resistor to PB0 and PB1 attiny13 pins (pin 5 and 6). Attiny is powered from 5V source. Program is written in Bascom. One thing that should be done while programming attiny is to change lfuse from 6A to 7A so that MCU clock is changed from default 1.2MHz to 9.6MHz and that also changes PWM speed so there is no visible blinking of LED’s due to low PWM frequency.

And here is source and compiled hex file for download


pwmsveca.bas
pwmsveca.hex

Arduino & ESP8266 Room Heating

After discovering cheap WiFi module ESP8266 I decided to upgrade my heater that was previously controlled by Arduino and connected to my Raspberry Pi via USB cable. Heater elements are connected to Arduino via Solid State Relay. Arduino uses PID control to achieve defined temperature and room temperature is read using digital sensor DS18B20. I had some OLED display that I got from seeedstudio and used it to display current and defined temperature on it. Arduino is connected to ESP8266. On my Raspbery Pi i made web interface and using simple python scripts i get data from Arduino and set temperature back. On front panel there is also rotary encoder used for setting temperature manually. ESP8266 is loaded with NodeMCU Lua firmware and it currently acts as simple telnet client. from RPI I send “uart.write(0,\”!6\\r\\n\”)\r\n” and ESP8266 sends to serial port !6 with carriage return and arduino send back for example 22.0,2000,21.0 (22.0Celsius current temperature, 2000 is PID output (0-4000) meaning that output is actually 50% and last value 21.0 is temperature that is defined). Sending !1,235 to arduino sets defined temperature to 23.5Celsius. I don’t have schematic but It,s pretty simple. DS18B20 data pin is connected to arduino pin 8 (use 4,7k pull up to +5v), rottary encoder is connected to pins 2 and 3 and two 10nF caps are used for debouncing (dont change pin 2 because interrupt on this pin used for trigerring read function). OLED uses 4 wires +5, GND and SDA, SCL connected to arduino SDA SCL pins. RX TX of arduino is connected to ESP8266 TX RX pins via logic level converter (arduino uses +5V and ESP8266 +3.3V) and that’s all.
Here are some making of photos and shaky video (I was recording holding my tablet in one hand and phone in another) code goes after them…

 

Image00001
A
rduino 3.3V power supply, Logic Level Converter and ESP8266 on proto board

Image00003
OLED from seeedstudio

Image00011
…glued to panel

Image00006
SSR

Image00012
Back side

Image00013Installed to wall…

Image00014
Close up of OLED and rottary encoder.

IMG_5401

IOS web app (jquery mobile and jquery knob used to set temperature by rotating knob same as rotary encoder)

I had idea to display custom text and draw images on OLED display but atmega328 has only 2Kb of SRAM and just OLED uses 1Kb and I had to remove code because Arduino was constantly crashing. Code is still there but commented. If someone has idea how to free some more SRAM from this code… On OLED temperature and defined temperature is displayed and after 40 seconds display goes to screensaver mode to save OLED from burning out (I think I read somewhere that OLED can burn out same as TFT when same dots are always lit).

ESP8266 is set to AP and Client mode so that if connection to my router is off I can log manually to Heater (AP mode) and change Client parameters if needed. So you need to execute this…

and this two scripts are uploaded to ESP8266 (you can use Lua Loader)

init.lua

tel.lua

Python scripts for reading and setting temperatures…

set.py

read.py

web interface php page (jquery mobile and jquery knob…)

webint.php

And here are all files zipped


heater_files.zip

Arduino NodeMCU and esp8266

I recently got esp8266 cheap wifi module. I had idea to use it with arduino and existing project that was using CmdMessenger library to comunicate over serial/usb port. After playing with esp8266 I found nice solution to how to replace serial cable. I installed NodeMCU on esp8266 and installed on it two scripts

and

when booting telnet server is opened on port 1001 and ip address is sent to arduino (“5,192.168.0.10;”) so that it can be printed on LCD. When connected from computer to esp8266 using python (terminal on 1001) i send for example  uart.write(0,”1,255;”) and “1,255;” is sent to arduino and when arduino send something back to PC i send it like “print”123″” and 123 is printed on terminal/sent to python.

Hotkeys

I have couple of programs that I use very often and I needed some utility that would let me start them using keyboard shortcut. I searched internet but could not find anything simple enough that would suite me, so I decided to make my own simple utility that would allow me this.

Hotkeys is very simple. Upon starting icon will be shown in taskbar and right click opens menu.

menu

selecting Edit Hotkeys opens new window where you can edit your shortcuts.

edit

Shown above is one shortcut for notepad. Ctrl is checked and “1” is entered as shortcut which means that pressing simultaneously Ctrl+1 will open notepad. Clicking on Apply shortcuts are saved (just closing window dismisses all changes). All shortcuts are saved into .ini file located in programs directory. Program is written in autoitscript and source is also available bellow for download. Any suggestions and comments are more than welcome 😉

HotKeys-install – Program Installation

HotKeys-en – zipped exe file

Hotkeys-src – source (autoitscript)