wofea_v10_hack icon indicating copy to clipboard operation
wofea_v10_hack copied to clipboard

Internal Speaker

Open jamestutton opened this issue 4 years ago • 4 comments

Hi and firstly many thanks for the project. Not sure if it helpful but did some testing of the GPIO's for the internal speaker and it seems to be some sort of preprogrammed audio chip.

Not sure on its iner workings but toggling GPIO12 causes it to emit various sounds and sound bites. So it seems these are stored in the audio chip itself.

Stored Messages/Sounds:

  • *Sound: Siren
  • *Sound: Door Bell
  • *Sound: Chime Rising
  • Gap of 2
  • Welcome to Wifi Host?
  • Connect Succeed
  • Connecting
  • Disarmed
  • Armed
  • Hub Mode?
  • Cleared all users?
  • Failed to Clear all Users
  • Please use mobile app for wifi configuration
  • Wifi Configuration Timeout
  • Armed in 30 Seconds
  • Welcome
  • Gap of 2
  • **Seem to repeat in porbably Chinese
  • Gap of 2
  • **Seem to repeat in another language

GPIO13 Going Low Seems to Reset the loop

jamestutton avatar Jun 09 '20 14:06 jamestutton

So brought a second unit and did some work with logic analyser and found it uses 100us Timing so below is a POC for Armed/Disarmed Voice Messages

esphome:
...............
...............
  on_boot:
    priority: 100 # Highest priority, ensures light turns on without delay.
    then:
      - output.turn_on: audio_pin13
      - output.turn_on: audio_pin12
...............
...............
output:
...............
#Audio Not sure yet
  - platform: gpio
    pin: 
      number: GPIO14
      inverted: True
    id: audio_pin14

# Audio Loop Reset
  - platform: gpio
    pin: 
      number: GPIO13
      inverted: True
    id: audio_pin13  
    
# Audio Loop Play/Next
  - platform: gpio
    pin: 
      number: GPIO12
      inverted: True
    id: audio_pin12   

switch:
...............
  - platform: template
    name: "Armed"
    id : armed_state
    icon : "mdi:home-lock"
    optimistic: True
    restore_state: True
    turn_on_action:
        - lambda: |-
            int _steps = 11;
            id(audio_pin13).turn_off();
            delayMicroseconds(120);
            id(audio_pin13).turn_on();
            for(int i = 1; i <= _steps; i++) {
              id(audio_pin12).turn_off();
              delayMicroseconds(100);
              id(audio_pin12).turn_on();
              delayMicroseconds(100);
            }
            id(audio_pin13).turn_on();
            id(audio_pin12).turn_on();
    #Disarmed        
    turn_off_action:
        - lambda: |-
            int _steps = 10;
            id(audio_pin13).turn_off();
            delayMicroseconds(120);
            id(audio_pin13).turn_on();
            for(int i = 1; i <= _steps; i++) {
              id(audio_pin12).turn_off();
              delayMicroseconds(100);
              id(audio_pin12).turn_on();
              delayMicroseconds(100);
            }
            id(audio_pin13).turn_on();
            id(audio_pin12).turn_on();

Still not sure what role GPIO14 play in the process. But doesnt seem to be required. Need to do further testing but just changing the int_steps and using the above allows you to access the audio prompts.

jamestutton avatar Jul 11 '20 08:07 jamestutton

Impressive works ! I will try and add this to project.

Thanks you.

Le sam. 11 juil. 2020 à 10:10, James Tutton [email protected] a écrit :

So brought a second unit and did some work with logic analyser and found it uses 100us Timing so below is a POC for Armed/Disarmed Voice Messages

esphome: ............... ............... on_boot: priority: 100 # Highest priority, ensures light turns on without delay. then: - output.turn_on: audio_pin13 - output.turn_on: audio_pin12 ............... ............... output: ............... #Audio Not sure yet

  • platform: gpio pin: number: GPIO14 inverted: True id: audio_pin14

Audio Loop Reset

  • platform: gpio pin: number: GPIO13 inverted: True id: audio_pin13

Audio Loop Play/Next

  • platform: gpio pin: number: GPIO12 inverted: True id: audio_pin12

switch: ...............

  • platform: template name: "Armed" id : armed_state icon : "mdi:home-lock" optimistic: True restore_state: True turn_on_action: - lambda: |- int _steps = 11; id(audio_pin13).turn_off(); delayMicroseconds(120); id(audio_pin13).turn_on(); for(int i = 1; i <= _steps; i++) { id(audio_pin12).turn_off(); delayMicroseconds(100); id(audio_pin12).turn_on(); delayMicroseconds(100); } id(audio_pin13).turn_on(); id(audio_pin12).turn_on(); #Disarmed turn_off_action: - lambda: |- int _steps = 10; id(audio_pin13).turn_off(); delayMicroseconds(120); id(audio_pin13).turn_on(); for(int i = 1; i <= _steps; i++) { id(audio_pin12).turn_off(); delayMicroseconds(100); id(audio_pin12).turn_on(); delayMicroseconds(100); } id(audio_pin13).turn_on(); id(audio_pin12).turn_on();

Still not sure what role GPIO14 play in the process. But doesnt seem to be required. Need to do further testing but just changing the int_steps and using the above allows you to access the audio prompts.

GPIO 12 and 13

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/nbergont/wofea_v10_hack/issues/3#issuecomment-657012779, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABHZQGFWS7YUFXZUCLVSDBDR3AM6BANCNFSM4NZPGLBA .

nbergont avatar Jul 19 '20 16:07 nbergont

Slight refinement as didn't zero the loop for some reason

  • platform: template name: "Armed" id : armed_state icon : "mdi:home-lock" optimistic: True restore_state: True turn_on_action: - lambda: |- int track = 10; id(audio_pin13).turn_off(); delayMicroseconds(120); id(audio_pin13).turn_on(); for(int i = 0; i <= track; i++) { id(audio_pin12).turn_off(); delayMicroseconds(100); id(audio_pin12).turn_on(); delayMicroseconds(100); } id(audio_pin13).turn_on(); id(audio_pin12).turn_on(); turn_off_action: - lambda: |- int track = 9; id(audio_pin13).turn_off(); delayMicroseconds(120); id(audio_pin13).turn_on(); for(int i = 0; i <= track; i++) { id(audio_pin12).turn_off(); delayMicroseconds(100); id(audio_pin12).turn_on(); delayMicroseconds(100); } id(audio_pin13).turn_on(); id(audio_pin12).turn_on();

jamestutton avatar Aug 03 '20 14:08 jamestutton

Dear Nicolas (and James) Thanks for this super project. Thanks to you both this little gadget from China is very useful indeed. I think audio sample 10 "Hub Mode" might in fact be "Home Mode". At least that is the use case I apply it to. If I am working alone at home and the family leave temporarily without securing all doors and windows I set this mode with this audio feedback "Home Mode" and the Wofea V10 gives audio sample 17 "Welcome" when someone re-enters. I am using Home Assistant "manual" alarm panel for the main Alarm state machine. I also have added OpenMqttGateway on an ESP32 as a redundant method of capturing RF codes. I may try to make the system fallback to your local ESPhome-only alarm system in case of HA outage. Next step is to add battery backup for the Wofea V10. I added a TP4056 wired to the BAT connector on the circuit board. Cheers Barry

monocycler avatar Jun 20 '21 15:06 monocycler