Wifi signal strength indication using esp8266

This is a fun project. Rather a very simple project. I am using the RSSI level checking of the esp8266 chip to monitor the signal strength of the surrounding wi-fi signals.

There are very few applications that i can think using this.

  1. You can check where the wi-fi signal is strong in a public place and stand near it to enjoy your free wi-fi more comfortably.
  2. location finding using the signal strength. Well as you go near the object the signal will become stronger and hence location finding device.
  3. You can also use some pretty special algorithm and some positioning mathematics to triangulate the relative position of a particular station.

Code:

AT+CWLAP

This is this simple one line of the code that you need to send to the esp8266 and the esp8266 will transmit the message from where you can use string manipulation to gather the information needed.

 

FFT Analysis of 200Khz Square wave

DSO screenshot of 200khz rectangular wave
DSO screenshot of 200khz rectangular wave

Generated 200khz square wave with 50% duty cycle on atmega32.
Code is written in assemble language.

// Created: 9/7/2018 8:24:31 AM
// Author : abhay
.INCLUDE "M32ADEF.INC"
//.MACRO INITSTACK
LDI R16,HIGH(RAMEND)
OUT SPH,R16
LDI R16,LOW(RAMEND)
OUT SPL,R16
//.ENDMACRO
// INITSTACK
LDI R16,0X02
SBI DDRB,1
SBI DDRB,3
LDI R17,0
OUT PORTB,R17
BEGIN: RCALL DELAY
EOR R17,R16
OUT PORTB,R17
// OUT OCR0,128
RJMP BEGIN
DELAY:
LDI R22,200
OUT OCR0,R22
LDI R20,0XF2
OUT TCNT0,R20
LDI R20,0X01
OUT TCCR0,R20
AGAIN:
IN R20,TIFR
SBRS R20,TOV0
RJMP AGAIN
LDI R20,0X00
OUT TCCR0,R20
LDI R20,(1<<TOV0)
OUT TIFR,R20
RET

DSO screenshot of 200khz rectangular wave
DSO screenshot of 200khz rectangular wave
FFT of pulse showing main lobe and one side lobe.

In this fft, it can be clearly seen that the 200khz pulse is represented by a high but we can also see the harmonic of the pulse.

Here are some more fft

Buzzer interfacing with atmega32

ASM Code for buzzer testing
; Created: 9/7/2018 8:24:31 AM
; Author : abhay
;
.INCLUDE "M32ADEF.INC"

.ORG 0
LDI R16,HIGH(RAMEND)
OUT SPH,R16
LDI R16,LOW(RAMEND)
OUT SPL,R16
BACK:
LDI R16,0X01
OUT PORTD,R16
CALL DELAY
LDI R16,0X00
;COM R16
NOP
OUT PORTD,R16
CALL DELAY
call dfor
RJMP BACK
.ORG 0x300
DELAY:
;timing delay
LDI R29,1
L4: LDI R20,10
L1: LDI R21,100
L2: LDI R22,32
L3:
NOP
NOP
DEC R22
BRNE L3
DEC R21
BRNE L2
DEC R20
BRNE L1
DEC R29
BRNE L4
RET
dfor:
;for loop
ldi r30,10
loop: ldi r31,0
call delay
dec r30
brne loop
ret

Calculation for loop timings
crystal frequency = 16Mhz = 16,000,000 Hz
calculate time period of one clock cycle
1/16MHz = 62.5 nano second

clock cycle
NOP – no operation = 1 cycle
DEC – decrement = 1 cycle
BRNE – branch if not equal (basically a for a loop with down counting) = 1/2 cycle

this will be around 5 cycles

for example a delay of 1s
1second = 10^9 nano seconds = 1000,000,000
1000,000,000/(62.5 x 5)=3200,000
3200,00/32=100,000
100,000/100=1000
1000/200=5
5/5=1

so load the register with value
a=32
b=100
c=200
d=5

PAL Composite video timing

India moved to DVB T2 in 2015. I always wanted to make a system which can project images on to the biggest screen i can get my hands on. So here are details.

PAL = Phase Alternate Line

total of 625 lines

Field one + Field two  = 625 lines

each field line consist of

[ vertical sync ] [ horizontal sync + active video ]x n

each scan line if of 64 micro second. (strict constraints don’t play with margins)

each 64 micrsecond line starts with

[Horizontal Sync = 4.7 us] [ color burst = 8us] [active data] [4 us of black level] = 64 us

This scan is done from the composite line of sony playstation 2. So i am taking this as a reference.

help is taken from here

Additional notes here

ESP8266 voltage spikes on power rail

I used esp8266 for broadcasting message to my website. But to operate this chip smoothly one needs to redesign its power supply.

There are voltage spikes of around 320 mV

esp8266 voltage spikes on power rail
esp8266 voltage spikes on power rail

at normal operation the chip uses around 70 mA or current. and when broadcasting something over WiFi current  can rise to about 170mA( according to its datasheet).

This all is not the problem. Because everything works.

Problem is the voltage drop accross the lm317t.

Input voltage = 12v

output voltage = 3.3v

voltage difference = 12v – 3.3v = 8.7v

load current = 105 ma

power dissipating = 8.7V x 0.105A = 0.9135W

That’s a lot of power which is being thermal dissipated.

I used a very tiny heat sink. Also the heat sink is attached by a drop of fevicol instead of thermal paste (cheap solution)

My Suggestion:
use a 5V input at lm317t

volatge difference = 5v – 3.3v = 1.7v

power dissipation = 1.7 x 0.105 = 0.178 W

 

Internet of thing Digital Thermometer DS18B20

I purchased this ic a long time ago. Never had any chance of using it. But now the this small itsy bitsy integrated circuit is sending data on the internet.

You can check the link at http://abhaykant.com/mtb

It is connected on a custom gateway device.

The ds18b20 can take power in two ways. The circuit that i made is using the parasite power.


This time i used clear nail pail paint over the copper trace.

ds182b20 interface schematic
ds182b20 interface schematic

printed circuit board is designed in KiCad open source EDA tool.

 

UPDATE : 14 September 2018

Using nail paint as a substitute for PCB lacquer is a cheap solution. It should be avoided when making a rugged PCB. If their is a lot a mechanical vibrations and stress, then the nail paint will chip away leading to oxidation.

7805 based power supply with Voltage and current protection

7805 linear voltage regulator is an inexpensive solution. But the ic doesnt include any form of protection. So, the voltage and current protection should be externally added.

There is high chance of reversing the polarity if you dont keep which wire is what. I did the same mistake and blown the aluminium electrolytic capacitors with 7805 ic.

Below is the revised circuit from 5V voltage regulator using 7805 | Complete Process.

schematic of 7805 based power supply with Voltage and current protection
schematic of 7805 based power supply with Voltage and current protection

3.3 volt receiver signal level Interface board for esp8266-01

In my previous attempt at designing this board here. It was good. But to make the pcb smaller. I redesigned the pcb, i shifted some component here and there.

This PCB contains a 3.3v level shifter at the receiver pin.

Here are the schematics and pcb layout.

esp8266-01 interface schematics
esp8266-01 interface schematics
drill layout top esp interface
drill layout top esp interface
top silk layer esp interface
top silk layer esp interface
bottom trace esp interface
bottom trace esp interface
Top View of esp8266  interface board
Top View of esp8266 interface board
PCB bottom copper traces and pads
PCB bottom copper traces and pads

Etching time : 1 hour and 20 minutes

That’s very long time but the solution is used up. as this is a small board i don’t want to dip the board in new solution. Also i let the PCB sit for a while , and by doing this the etching is uniform and the i also found out that the traces are much sharper than before. So it is a good idea to let it sit for around 30 minutes before you shake the container. As i am doing this manually, so that is why it is a slow process.