Friday, July 8, 2016

ESP8266 Basic IR sensor

ESP8266 Basis can also read Infra Red sensor
The manual of version 3 ESP8266Basic contains a little error IR receiver part.

ir.recv.setup(pin)
set the pin used for the IR reception (IR receiver connected to the pin)
example:
ir.recv.init(5) ‘set the pin 5
Needs to be
ir.recv.setup(pin)
set the pin used for the IR reception (IR receiver connected to the pin)
example:
ir.recv.setup( 5 ) ‘set the pin 5

I used the demo program below to test a  "TL1838 VS1838B 1838 38Khz Universal IR Infrared Receiver"  ( Aliexpress : 100 pcs less than 7 euro / The 37in1 Arduino KY-022 sensor should also work fine.) on pin GPIO14:

'  IR receive demo  ESP Basic 3.0.Alpha 8 
' http://blog.jeronimus.net

ir.recv.setup( 14 )
wprint "<h1> Testing IR input</h1>"
irbranch [DoIR]
wait

[DoIR]
wprint "<BR>IR received : " & ir.recv.full( )
returngui

return

end

Sometimes i did get an additional signal code "ffffffff:NEC:0" but most times i receive usable codes.

ESP8266 Buzzer

Tested passive Buzzer with ESP8266 development board and ESP8266Basic.
Buzzer (+)  is connected to pin 15 (Where also RGB led is connected) . Other pin connected to GND.

If buzzer is connected to "not RGB pins" ( 0 ,2 4, 5, 14 ,16) the corresponding led lights up.
Program to test buzzer:
High and Low buttons are not PWM
only added for testing


cls
let d = 15
' Connect Buzzer to GND and pin 'd'

let v = 0

html | <h1>Test Buzzer</h1> |
html | <br> |

button "Low" , [SetPinLow]
button "High" , [SetPinHigh]

html | <br><br> |

button "SetSliders" , [SetSliders]
button " 0 " , [SlidersOff]
slider v , 0 , 500
button "MAX" , [SlidersMAX]


html | <br><br> |

button " Exit ", [Exit]

wait

[SetPinLow]
io(po,d,0)
wait
[SetPinHigh]
io(po,d,1)
wait


[SlidersMAX]
let v = 500
Goto [SetSliders]

[SlidersOff]
let v = 0
[SetSliders]
io(pwo,d,v)
wait

[Exit]
cls
end


Thursday, July 7, 2016

6in1 USB serial interface

6 in 1 Multifunction Serial Module CP2102 USB TTL 485 to 232 Convert Module 3.3V/5V compatible

Documentation:

1. Why this post?

I am experimenting with Arduino / Genuino and ESP8266. I wanted a spare USB TTL 5 and 3.3 V interface and found this interesting device/circuit on Aliexpress.  Due to it's interesting features and its price (in June 2016 it even dropped below 3.00 Euro!) i wanted to give it a try. I ordered it and received it after some time together with other interesting hardware.
Then came the main disadvantage of this module : documentation. How to use put the switches to use this device. Most internet pages contained info where to buy  this device or info in Chinese (with pictures!). I still need to test the device (Perhaps i will post some results in this blog, I will not test all modes!)  but i want to share some info that i have found  (for you and for myself! ) 

2 Short description

- A USB 2.0 to TTL UART 6PIN CP2102 Module Serial Converter. Connect MCU easily to your computer!
This item uses the USB to serial chip CP2102, it has the advantages of high-speed, stability, small size. It can help realize the equal energy level interconversion of the USB/TTL/RS232/RS485. It is the essential tool in communication debugging.
Also +5 an +3.3 Volt power

3 Long description 

.Small size: the PCB board size is just 3.1CM*1.8CM, it is even smaller than the U disk.
Compatible with the 3.3V and 5v
3.3V and 5V voltage: can use this module to provide power suppler for the Microcontroller , the max output current is 500ma.
Over current protection: on-board recovery fuse, it can protect the Microcontroller and the PC from the damage of the Short Circuit. The fuse will automatic shutdown and will be work normally after the recovery of the circuit.
Indicator LED: When begin data transmission, the indicator LED will light.
TTL electronic level interface.
232 electronic level interface.
485 level interface: Automatic transceiver control no need for the control line. Default receiving state, when sending data, the state will be changed into sending state.
USB, TTL, RS232,,RS485 four electronic levels free transfer: unique circuit design, uses the switch to realize the functions conversion, it is very fast and convenient.
Stable communication rate: The max rate is 1Mbps.
DTR,RTS control signals: Multifunciton, support MSP430 BSL download.- Stable and reliable chipset CP2102
- USB specification 2.0 compliant with full-speed 12Mbps.
- Standard USB type A male and TTL 6pin connector. 6pins for 3.3V, RST, TXD, RXD, GND & 5V.
- All handshaking and modem interface signals.
- Baud rates: 300 bps to 1.5 Mbps.
- Byte receive buffer; 640 byte transmit buffer.
- Hardware or X-On/X-Off handshaking supported.
- Event character support Line break transmission.
- USB suspend states supported via SUSPEND pins.
- Temperature Range: -40 to +85.
- Supports Windows 98SE, 2000, XP, Vista, Window7, Mac OS 9, Mac OS X & Linux 2.40.

4. Pins / connections

DTR
+5V
+3V3
TXD
RXD
GND

RTS
A
B
232T
232R
GND

USB connector

5. Switches

TTL - 232-485

DIL (2x)
485
USB

6. Functions

(Not tested /  found in documentaton!)

Model Dil code1(USB) Dil code2(485) Switch S1 Picture
USB to TTL
On
Off
Up(232-TTL)
USB to  232
On
Off
Up(232-TTL)
USB to 485
On
On
Up(232-TTL)
TTL to 232
Off
Off
Up(232-TTL)
TTL to 485
Off
On
Up(232-TTL)
232 to 485
Off
On
Down (232-485)

My comment: Picture above switch for 232-TTL / 232-485 seems different than text

USB
My comment: Strange, it seems switch for 232-TTL / 232-485 in pictures below is different

7. Interface usage:


Mode Pin Function
TTL Level Interface TXD TTL Transmit
TTL Level Interface RXD TTL Receive
TTL Level Interface GND TTL ground
232 Level Interface 232-TX 232 Transmit
232 Level Interface 232-RX 232 Receive
232 Level Interface GND 232 Ground
485 Level Interface A 485A+
485 Level Interface B 485B-
+5V Voltage Output +5V +5V Voltage Output
3.3 Voltage Output 3V3 3.3V Voltage Output
DTR Output DTR Special Function
RTS Output RTS Special Function

8.Product testing

I did not test this yet. This is only some text i found in "internet documentation" !
Using the USB TO TTL self-closed loop and the USB TO RS232 self-closed loop to test the product functions:

- USB TO TTL self-closed loop

Use the Dupont line to connect the TTL-TXD and TTL-RXD of this module, place the dial switch according to the function introduction, then insert this module into the computer, uses the serial debugging helper to send the data, check whether there has corresponding back data. If it can receiving the receiving data, it proves that this module can work normally.

- USB TO RS232 self-closed loop

Use the Dupont line to connect the 232-TXD and 232-RXD of this module, place the dial switch according to the function introduction, then insert this module into the computer, uses the serial debugging helper to send the data, check whether there has corresponding back data. If it can receiving the receiving data, it proves that this module can work normally.

The default state of the black two dial switch is "ON",  it is suitable for all conditions.

9.Mechanical drawing




10. Links

Explanation: 

Video + drivers

Wednesday, July 6, 2016

More Linux than Windows visitors

My blog's website statistics (Google) show that i have
more Linux visitors than Windows visitors ( Week statistics on 6 July 2016 13:00) !!!

Operating system Pageviews %
Linux 42%
Windows40%
Android 6%
iPhone 6%
Unix2%
Macintosh <1%
BlackBerry <1%


Browser Pageviews %
Firefox49%
Chrome41%
Safari6%
Internet Explorer1%
Mobile Safari<1%
SamsungBrowser<1%


ESP8266 Basic controls laser KY-008

Using laser module with ESP8266

To actually control some hardware with the ESP8266Basic output test program i connected a KY-008 laser module.
Some of these KY-008 modules have power connections reversed so test the module first by connecting it with GND and the VCC pin (+3.3 V).

The "standard Red test leds" on my module are on with the Low signal and off with the High signal.
I wanted the Laser led behave the same way.
Therefore i connected the laser module to VCC  and a GPIO pin.

Reminder of you use GPIO4 or GPIO5; on my board  GPIO4 = 5 and GPIO5 = 4  (reversed see a previous blog post )


If connected between VCC and GPIO Pin <n>
clicking
[Set Pin <n>Low] will turn Laser on,
[Set Pin <n> High] will turn Laser off

Tuesday, July 5, 2016

ESP8266 Basic Test OutputPins program

I created a ESP8266 Basic Output test program to control the output pins of this ESP Wifi testboard flashed with ESP8266Basic.
Running the program gives a HTML page to control the output pins of this test board. 
Screendump
Pin 0 , 2 ,4 ,5, 14 and 16 can be set Low (0) or High (1) 
Clicking the button immedeate changes the state.
On this ESP8266 test board Red leds will light if the signal is set to Low

Pin 12 , 13 and 15 are configured as PWM output pins and are controlled by the sliders. Pressing the SetSliders button send the PWM values to the output port. Pressing SlidersOff sets al the PWM values to 0
On the RSP8266 test board it is used to control the RGB led.
' Test program version 0.1 - 20160630
cls
pw12=0
pw13=0
pw15=0
html | <h1>Test Pin Output</h1> |
html | <table> |
html | <tr><td> |
button "Set Pin  0 Low" , [SetPin0Low]
html | </td><td> |
button "Set Pin  0 High", [SetPin0High]
html | </td></tr><tr><td> |button "Set Pin  2 Low" , [SetPin2Low] 
html | </td><td> |
button "Set Pin  2 High", [SetPin2High] 
html | </td></tr><tr><td> |
button "Set Pin  4 Low" , [SetPin4Low] 
html | </td><td> |
button "Set Pin  4 High", [SetPin4High] 
html | </td></tr><tr><td> |
button "Set Pin  5 Low" , [SetPin5Low] 
html | </td><td> |
button "Set Pin  5 High", [SetPin5High] 
html | </td></tr><tr><td> |
button "Set Pin 14 Low" , [SetPin14Low] 
html | </td><td> |
button "Set Pin 14 High", [SetPin14High] 
html | </td></tr><tr><td> |
button "Set Pin 16 Low" , [SetPin16Low] 
html | </td><td> |
button "Set Pin 16 High", [SetPin16High]
html | </td></tr><tr><td>Pin 12: |
slider pw12 , 0 , 500
html | <br>Pin 13: |
slider pw13 , 0 , 500
html | <br>Pin 15: |
slider pw15 , 0 , 500
html | </td><td> |
button "SetSliders" , [SetSliders]
html | <br> |
button "SlidersOff" , [SlidersOff] 
 html | </td></tr><tr><td> </td><td> |
button "  Exit  ", [Exit] 
html | </td></tr></table> |
wait 

[SetPin0Low] 
io(po,0,0) 
wait 
[SetPin0High] 
io(po,0,1) 
wait 

[SetPin2Low] 
io(po,2,0) 
wait 
[SetPin2High] 
io(po,2,1) 
wait 

[SetPin4Low] 
io(po,4,0) 
wait 
[SetPin4High] 
io(po,4,1) 
wait 

[SetPin5Low] 
io(po,5,0) 
wait 
[SetPin5High] 
io(po,5,1) 
wait 

[SetPin14Low] 
io(po,14,0) 
wait 
[SetPin14High] 
io(po,14,1) 
wait 

[SetPin16Low] 
io(po,16,0) 
wait 
[SetPin16High] 
io(po,16,1) 
wait

[SlidersOff] 
pw12 = 0
pw13 = 0
pw15 = 0
[SetSliders] 
io(pwo,12,pw12)
io(pwo,13,pw13)
io(pwo,15,pw15)
wait 
[Exit] 
end

Monday, July 4, 2016

ESP8266 SDK experimentboard

Some info about another ESP8266 SDK experimentboard
with ESP201

Features
- pins for direct access to ESP201

- 2 USB connectors:
micro USB = Power
mini USB  = Power & Program

- 2 switches
S2 GPIO0
S3 GPIO2
- DHT11 temperature humidity sensor connected to IO4. Watch out how to connect the DHT11 as there are different versions of this board !
- 10K pot for regulator ADC input port
- RGB led  IO15, IO13, IO12
- White led IO14
- Relay coil (and green led)  IO16
- Buzzer (Active buzzer) IO5
- DIP switch

The hardware can be connected / disconnected using the DIP Switches

DIP Switch functions

R RGB Red IO15 ( to boot application mode must be on !)
G RGB Green IO13
B RGB Blue IO12
W White led IO14
J Relay coil (and Green led) IO16
B Buzzer (Active) IO5
K1 GND to IO15 ( same as RGB led)
K2 GND to IO0 ( same as S2 - ON to reprogram )

How to write flash
Power off board.
Keep S2 pressed power on.
Now possible it is possible to write the ESP201 flash with computer connected to mini USB connector (to flash LUA or some other system ( ESP8266Basic) to the ESP8266 )

Schematics
Source http://www.bpower.nl/

Com Port problems
How do I find the device which has Com Port X reserved - want to reclaim the port number for different device.:  http://blog.jeronimus.net/2016/02/esp8266-experimentboard.html

Warning
After using the mini USB this board a few times
 the mini USB connector did break off. (See picture).

Some usefull links

http://myesp8266.blogspot.nl/2015/03/other-interesting-board-is-this-board.html

http://scottsnowden.co.uk/esp8266-developmentbreakout-board-arrived/


Friday, July 1, 2016

ESP8266 WangTongze Arduino Uno Shield

To use with Arduino Uno / Genuino i did buy a time ago this ESP8266 Arduino Uno Shield.
On the PCB is printed:
Arduino ESP8266 WiFi
Shield version 1.0
by WangTongze

More info & tech support please go to elecshop.ml

As there are more shields and Arduino ESP8266 combinations.
The elecshop website is not working but i did find this video  https://www.youtube.com/watch?v=LJcYgR479Vw
 and some info on

P1+P2 TTLSW Disconnect ESP8266 from Arduino (to flash it)
P3 DFU/NOR Programming mode on/of to flash ( DFU )
P4 DFU LED Use DFU LED yes/no
This  WangTongze ESP8266 Arduino Uno shield has 4 leds on board (PWR,DFU,AP,STA )

With an Arduino Uno i could not easy figure out how to make it work or find a working ready to go example project. I decided making it work "stand alone" first (without Arduino) connect it using the maintenance port.

In one of my projects with an ESP8266 the USB cable connections where:
Red VCC +5V not connected
Black GND
Green TXD
White RXD
and the ESP8266 was powered separate with 3 AA batteries

I decided to connected the USB cable (Spoiler: this is not the right connection !)
Green TXD
White RXD
Red +5V
Black GND
3V3 (not connected)

and set all the dip switches "DOWN"
Some of the lights went on when connecting the USB cable to my computer.
And i found  a new Wifi signal AI-THINKER_F50152

I connected the Wifi with my smartphone.
The device had IP adres192.168.4.1 (.2 is address of the connected smartphone)
A port scan gave no open ports.
Webpage in browser gave “webpage not available”
I tried to connect the USB with a Putty terminal program. (baud rate 115200) 
but had no luck. (USB found as com2 )
Finally i decided to swat the TXD and RXD connections. 
Pressing the ESP reset button (Als DIP switches down) gave a message:
"Arduino ESP8266 Shield v.1.0" to the Putty terminal
Typing AT commands (also tried some other things) did not give results.

I finally decided to flash it with ESP8266Basic


DIP buttons DOWN DOWN UP UP ESP8266 Basic (4M) flashed (See previous article and ESP8266 Website for more details.
Restart with DIP switches DOWN DOWN DOWN DOWN gave ESP Wifi signal. Configuring home network connection and tests with some basic programs (Wifi scan) went well.

Conclusion
1) Flashing this module (with ESP8266Basic) is possible
1) Buttons DOWN DOWN UP UP  
=> Flash the ESP8266
2) Buttons DOWN DOWN DOWN DOWN => "normal (stand alone) running " mode

3) USB cable connection is
White TXD
Green RXD
Red +5V
Black GND
3V3 (not connected)
USB cable info did tell me that Green is the cable TXD line and White the cable RXD line.
The cable TXD need to be connected with the ESP8266 RXD
The cable RXD need to be connected with the ESP8266 TXD
I trust this board more than the other board (that also had GPIO4 and GPIO5 swapped.) Therefore I expect the other ESP8266 test board RXD and TXD labels are wrong.

A next step could be connecting the shield to Arduino and test communication to the Arduino.