Your Pages‎ > ‎

Hardware Examples

Here is where you can add info of any interesting hardware you have come across, such as these cute little touch pads...

Illuminated Touch Pad - Electroguard 3/4/18
An ebay search for "Capacitive Anti-interference Touch" shows these capacitive touch switches available in various colours for less than £2.
Being capacitive they can be protected behind clear glass or plastic - the digital output can drive a relay - working voltage is from 2.7 to 6 volts
The module comes configured for Toggle (touch On, touch Off) but I found that bridging a pair of unmarked solder pads converts it to Momentary.
The touch area is edge-lit by the coloured LED - it lights up when On if in Toggle mode, or when Touched if in Momentary mode.
Below is a script which uses it, although an ESP device is not actually essential because the touch pad could be used stand-alone with a 5v relay.
The script caters for a relay and LED which can be operated by a local hardware button as well as the touch pad sensor - this was done mainly to highlight the touch pads inbuilt Toggle action compared to the momentary button press, but a local button can be a handy thing to have anyway.  


Code:Touch Pad

title$  = "Touch Pad"                        'Using an edge-lit coloured Touch Pad sensor

ledpin = 15                                       'my RGB LED Red pin  (active low)

ledoff = 1                                          'LED Off state

pin.mode ledpin, output

pin(ledpin) = ledoff                           'initialise LED to Off

relaypin = 12                                    'using my RGB LED Green pin instead of a relay to toggle the RGB LED between Red and Green

relayoff = 0                                        'Relay Off state  (active high)

pin.mode relaypin, output                 

pin(relaypin) = relayoff                      'initialise Relay to Off (or in my case turn RGB LED to Green),

sensorpin = 5                                    'output from Touch Pad   (active high)

sensoroff = 0                                     'Sensor un-triggered state

pin.mode sensorpin, input

interrupt sensorpin, triggered

buttonpin = 0                                     'button

buttonoff = 1                                      'button Off state (active low)

pin.mode buttonpin, input, pullup

interrupt buttonpin, pressed

wait


triggered:

if pin(sensorpin) = sensoroff then

pin(ledpin) = ledoff

pin(relaypin) = relayoff

else

pin(ledpin) = 1 - ledoff

pin(relaypin) = 1 - relayoff

endif

return


pressed:

if pin(buttonpin) = buttonoff then

 pin(ledpin) = ledoff

pin(relaypin) = relayoff

else

pin(ledpin) = 1 - ledoff

 pin(relaypin) = 1 - relayoff

endif

return



Alternatively, you can get 5 different coloured illuminated LED tactile push buttons for £1.50 free postage.
Same as a normal momentary tactile button, but with coloured button lit by LED.  Search for "LED tactile".





--------------------------------

Electroguard - 1/6/18
These dual triple shield adapters may be handy if you use Wemos D1 Mini's.
They are called dual triple because they can be cut down from triple to dual if wished.
Even the single 'offcut' makes a handy plug-in proto-shield.

All the 'outer' pins connect to the same pin on each of the 3 banks.
But they also connect to the first inboard hole in the prototype areas.

They are great for creating dual-controller bridging modules with 2x D1 Mini's connected via serial or serial2 side by side, and still having a spare shield available for other things.
(A dual-processor project is already done and waiting to be published - others planned)

Cost less than a quid from ebay with free delivery, search for "dual triple shield wemos".
----------------------------------


Comentarios