Index

37 Sensors Overview

Sensor.Engine MICRO

  1. Sensor.Engine MICRO Features
  2. Pinout and Pin use
  3. BASIC Overview
  4. SEM Library functions

37+ Sensors

  1. Analog Hall-effect
  2. Analog Joystick
  3. Analog Temperature
  4. Ball Switch
  5. Bi-color LED
  6. Button
  7. Character LCD
  8. Flame
  9. Hall-effect Switch
  10. HMI Display
  11. Humidity and Temperature
  12. IR Receiver
  13. IR Transmitter
  14. Keypad
  15. LASER
  16. Light Cup
  17. Liquid
  18. Mercury Switch
  19. Microphone
  20. Multicolor Flashing LED
  21. Obstacle Avoidance
  22. Photo Interruptor
  23. Photoresistor
  24. Piezo Driver or Annunciator
  25. Pulse
  26. Reed Switch
  27. Relays and Drivers
  28. RGB LED
  29. Rotary Encoder
  30. Servo
  31. Shock and Impulse
  32. Speaker
  33. Temperature 18B20
  34. Temperature Threshold
  35. Touch Sensor
  36. Tracking
  37. Ultrasonic Distance

USBmicro U4xx

  1. U401
  2. U421
  3. U451

CircuitGizmos

Projects

  1. Controlling MedeaWiz Sprite

Controlling MedeaWiz Sprite




The MedeaWiz Sprite ( http://www.medeawiz.com/ ) is a very small electronic device that plays videos. The videos for the Sprite can be located either on a USB flash/thumb drive or on an SD card. The Sprite will play one video by default in a loop. Other videos located on the flash device can be selected and played using the Sprite remote control.

Purchase from Amazon or TeamKingsley

images\14-1.png

images\14-2.png images\14-3.png

The Sprite can also be triggered by a button contact (or an equivalent "dry contact" circuit) to play a specific video file. The instructions that come with the Sprite (the manual can be downloaded before purchase) show how a button can be used to trigger the Sprite to play a video file. The instructions also show how a Programmable Logic Controller (PLC) or a PIR motion sensor can be connected directly to the Sprite to trigger video playback.

images\14-4.png

images\14-5.png

This triggering allows for a button or a device with a dry-contact output to trigger a single file. More complex triggering could be accomplished by using the Sensor.Engine MICRO to evaluate a single or multiple conditions based on sensor input, or scheduled time. The SEM will connect to the Sprite via the Sprite's I/O port and use serial commands to control the Sprite.

The Sprite I/O port provides a ground connection as well as +5V (100mA) that can be used to power the SEM. Serial control of the Sprite from the SEM is accomplished using the Tx and Rx serial lines. The connections for the I/O port are provided in the Sprite manual and shown here.

images\14-6.png

In the diagram above the rectangle named "Microprocessor" will be the Sensor.Engine MICRO. The SEM is connected to the Sprite with a small custom cable. The black wire is ground reference, the red wire provides 5V to power the SEM. (Disconnected during development as the USB connection provides 5V.)

images\14-7.png

The blue and green wires are serial communication. For this code the data received from the Sprite is not used.

The example program is rather simple: Scroll through a set of numbers ( 0 to 10 ) and when selected, play the file associated with the number.


'Sprite Controller    *  4 line program description appears in file selector
'                     *  up to the 21st character after the single appostrophe.
'                     *  
'                     *  
'---------------------*

OPTION EXPLICIT
OPTION DEFAULT NONE
OPTION AUTORUN ON


'====================================================
'Setup Code
'The setup code runs once when you start this program
'====================================================

'S.E:MICRO button interrupts and states
'Common to the SEM apps, etc.
SETPIN 7,  INTL, semRedBtnInt, PULLUP
SETPIN 24, INTL, semYelBtnInt, PULLUP
SETPIN 26, INTL, semGrnBtnInt, PULLUP
DIM semRedBtn AS INTEGER 'Button States
DIM semYelBtn AS INTEGER
DIM semGrnBtn AS INTEGER
semRedBtn = 0
semYelBtn = 0
semGrnBtn = 0

DIM FileNum AS INTEGER
DIM FileNumLimit AS INTEGER
FileNum = 0
FileNumLimit = 10


Text 0,0"Sprite Controller",,3,1
TEXT 64,12"  "+STR$(FileNum)+"  ",C,2,2
TEXT 0,57"Back   Frwd    Select",,3

DO

  IF semRedBtn > 1 THEN 
    semRedBtn = 0 
    CLS
    FileNum = FileNum - 1
    IF FileNum < 0 THEN FileNum = FileNumLimit
    Text 0,0"Sprite Controller",,3,1
    TEXT 64,12"  "+STR$(FileNum)+"  ",C,2,2
    TEXT 0,57"Back   Frwd    Select",,3
  ENDIF

  IF semYelBtn > 1 THEN 
    semYelBtn = 0
    CLS
    FileNum = FileNum + 1
    IF FileNum > FileNumLimit THEN FileNum = 0
    Text 0,0"Sprite Controller",,3,1
    TEXT 64,12"  "+STR$(FileNum)+"  ",C,2,2
    TEXT 0,57"Back   Frwd    Select",,3
  ENDIF

  IF semGrnBtn > 1 THEN 
    semGrnBtn = 0
    OPEN "COM1:9600" as #1
    PRINT #1CHR$(FileNum);
    CLOSE #1
  ENDIF
  
LOOP



'=====================================================
'S.E:MICRO Button Interrupt Subroutines
'Common to the SEM apps, etc.
'=====================================================

'Red/Yellow/Green button interrupt routines
' Standard SEM button routines.
' Testing semRedBtn > 1 for button press, > x for long button press

SUB semRedBtnInt
  semRedBtn = 1
  DO : PAUSE(5) : semRedBtn = semRedBtn + 5 : LOOP WHILE PIN(7) = 0
  PAUSE(20)
END SUB


SUB semYelBtnInt
  semYelBtn = 1
  DO : PAUSE(5) : semYelBtn = semYelBtn + 5 : LOOP WHILE PIN(24) = 0
  PAUSE(20)
END SUB


SUB semGrnBtnInt
  semGrnBtn = 1
  DO : PAUSE(5) : semGrnBtn = semGrnBtn + 5 : LOOP WHILE PIN(26) = 0
  PAUSE(20)
END SUB



The large centered number on the display shows which file is being played, or was last selected.

The red button decrements the file number. The yellow button increments the file number.

The green button selects/plays the numbered file.