Bloody Lola on Omega 2



  • We will need: two LEDs, a speaker, a 5 and 12 volt power supply, a motion sensor (12 volts only), a 3.3 volt power converter, a simple amplifier (any class D with 3-12 volts) and Omega 2. You will also need an optional flash drive or sd card to expand the disk space.
    We open the doll. We put the LEDs in the eyes and the speaker in the area of ​​the mouth with hot-melt. The speaker soldered to the amplifier, the LEDs are connected to field-effect transistors ... In general, we collect the following scheme.

    alt text

    Next, go to setting up the software. If you want to use i2s sound, we put b193 firmware on omega, because i2s doesn’t work further. If not, you can insert a sound card into the USB and then adjust the sound on this guide. If you do like me, then I wrote about working with i2s sound here. We connect to wifi and increase the disk space of omega 2. Everything is in detail in the manual here.
    After that we execute

    opkg update
    opkg install alsa-utils mpg123 python pyOnionGpio nano

    Now, our omega is almost able to speak and it remains only to write a Python script for this business. The logic is simple. A motion sensor opens a circuit between two GPIOs. On one we give a logical unit when turned on, the value of the second is read. When there is 0, then we begin to reproduce the terrible sounds and flashing LEDs. The rest of the time we are silent. Realization of all this looks like this.

    import onionGpio
    import subprocess
    import random

    gpioOut = onionGpio.OnionGpio (15)
    gpioOut.setOutputDirection (0)
    gpioOut.setValue (1)

    gpioObj = onionGpio.OnionGpio (17)
    status = gpioObj.setInputDirection ()

    while true:
        value = gpioObj.getValue ()

    if int (value) == 0:
        cmd = "fast-gpio pwm 18" + str (random.randint (5.15)) + "50"
        subprocess.call (cmd, stdout = subprocess.PIPE, shell = True)
        cmd = "fast-gpio pwm 19" + str (random.randint (2,10)) + "50"
        subprocess.call (cmd, stdout = subprocess.PIPE, shell = True)
        cmd = "mpg123 -f 256 -C / mnt / sda1 /" + str (random.randint (1.6)) + ".mp3"
        subprocess.call (cmd, stdout = subprocess.PIPE, shell = True)

    else:
        subprocess.call ("fast-gpio set 18 0", stdout = subprocess.PIPE, shell = True)
        subprocess.call ("fast-gpio set 19 0", stdout = subprocess.PIPE, shell = True)

    Files of terrible sounds are added to / mnt / sda1 under the names 1.mp3, 2.mp3 ... I have them 6. and one of them is randomly turned on. The PWM frequency of the Omega 2 outputs is also randomly turned on separately under the left and right eyes. Then we write two lines to rc.local by executing the command

    nano /etc/rc.local

    omega2-ctrl gpiomux set i2s i2s
    python /mnt/sda1/start.py

    As I think you guessed the script I quoted above, you need to save it in the / mnt / sda1 directory as start.py
    Next, the last step. Most creative. Makeup. I just asked my wife (cheater) and she did great. Thank you very much!
    alt text
    You can see how it all works with sound in the video below. In the dark, it's looks pretty creepy, to be honest. Hope you enjoyed it. Thanks for attention!

    https://youtu.be/f-GnMWJSe6k



  • nice job. thanks for sharing.


Log in to reply
 

Looks like your connection to Community was lost, please wait while we try to reconnect.