Friday, July 22, 2016

Presenter / Laser pointer IOT DIY (4)

This is a picture of the laser pointer / presenter.

I only added one button at the outside of the box. With more buttons the presenter perhaps could be more easy controlled. With only one button you can send different triggers to a program by pressing the button for a long or a short time.
The box is transparent. With this transparent box you can still use the RGB led and the LDR on ESP8266 module.

ESP8266Basic demo program for testing and using the laser pointer:

'   *** UseLaser.bas ***  
'   demo laser pointer
'  2016 -  JanJeronimus

cls
' Pin Button1 16 GPIO16
let PinButton1 = 16

' PinLaser    5 GPIO4
let PinLaser = 5

' Pin Reed / Button4 0 GPIO0
let PinReed = 0

' Pin Shake / Button5 2 GPIO2
let PinShake = 2

u = 0 
' u = use status 

html | <h1>Select item to control the laser</h1> |

html | <br> |
button "Button1", [Button1]
html | <br> |
button "On / Off with Button1", [ButtonT]
html | <br> |
button "Reed", [Reed]
html | <br> |
button "Shake", [Shake]
html | <br><br> |
button "On", [On]
html | <br> |
button "Off", [Off]
html | <br><br> |
button " Exit ", [Exit] 

timer 1000 ,[SetLaser]

wait 

[Button1]
u = PinButton1
wait

[ButtonT]
u = 980
wait

[Reed]
u = PinReed
wait

[Shake]
u = PinShake
wait

[Off]
u = 990
wait

[On]
u = 991
wait

[SetLaser]

' **  GPIO controlling the laser
'  * <30  u is GPIO number

if u < 30 then
io(po,PinLaser, io(pi,u) )
endif

'  ** Status Toggle with Button1
'  * u = 980  On if Button1
'  * u = 981   wait for release button
'  * u = 982  Off if Button1
'  * u = 983   wait for release button
if u = 980 then
 if io(pi,PinButton1) = 0 then
   io(po,PinLaser, io(pi,1) )
   u = 981        ' set status wait for release 
 endif
endif

' if wait for release
if u = 981 then
 if io(pi,PinButton1) = 1 then
   u = 982 
 endif
endif

if u = 982 then
 if io(pi,PinButton1) = 0 then
   io(po,PinLaser, io(pi,0) )
   u = 983        ' set status wait for release3 
 endif
endif

' if wait for release3
if u = 983 then
 if io(pi,PinButton1) = 1 then
   u = 980 
 endif
endif

'  ** Status Toggle
'  * u = 990 - 991 On / Off
if u = 990 then
io(po,PinLaser, io(pi,0) )
endif

if u = 991 then
io(po,PinLaser, io(pi,1) )
endif
wait

end

Besides the laser pointer some things you can do with this hardware:

- Presentation inside the presenter as webpages
- Wifi scan
- A simple alarm that starts if the switch vibration / tilt switch / shaking ball switch to detects if the module is moved with the next program:
- The Alarm can be switched off by pressing the Button1
- Alarm can be switched off with a magnet (using reed contact)
- The Light Detecting Resistor is currently inside the box. I have plans to move the LDR to the outside (on front of the box) for better sensibility.



Plans for modifications and adding other hardware
- Infra red led
- Infra red sensor / detector
- Move LDR outside the box
- Move RGB led outside the box (?)
- A second reed contact ???
- Connector for a headphone or other external devices
- .....

1 comment:

Unknown said...

Some nice projects here. Very impressed as to how much you have been able to get done with esp8266 basic.