-
Remake of leds devices
05/24/2017 at 10:15 • 0 commentsI'm currently working on the v2.0 of leds, so we can easily
- changes the number of leds used,
- Use different animation
- Change color of leds using hsv
- Save changes / load changes on EEPROM. -
Home Automation (milight/433Mhz devices)
04/19/2017 at 14:28 • 0 commentsHere a small demo for radio433/openlight.
- The 433Mhz receiver/transmitter are plugged on a Raspberry Pi Zero W
- The nrf24l01 transceiver is plugged on my computer
https://github.com/madnerdorg/radio433
https://github.com/madnerdorg/openlightSource:
https://bitbucket.org/fuzzillogic/433mhzforarduino/
https://github.com/henryk/openmili -
Offline voice commands recognition
04/19/2017 at 11:44 • 0 commentsControl websocket with snowboy (offline voice commands recognition)
Snowboy is used as an Hotword Detection Engine, but it works pretty well with predefined voice commands (and really fast).
You will need to record the voice commands on the snowboy website, you can login with a github account, once you have downloaded the model files, it will works without a network connection.
Install snowboy on a Raspberry Pi (check documentation if you have issues)
#!/bin/bash mkdir /opt/snowboy cd /opt/snowboy wget https://s3-us-west-2.amazonaws.com/snowboy/snowboy-releases/rpi-arm-raspbian-8.0-1.2.0.tar.bz2 tar -xvf rpi-arm-raspbian-8.0-1.2.0.tar.bz2 apt-get install python-pyaudio python3-pyaudio sox libatlas-base-dev pip install pyaudio # Generate alsa configuration for root cat > ~/.asoundrc << EOF pcm.!default { type asym playback.pcm { type plug slave.pcm "hw:0,0" } capture.pcm { type plug slave.pcm "hw:1,0" } } EOF rec test.wav
Python Demo with test (first model file with turn on the led, second model file will turn off the led)import snowboydecoder import sys import signal import websocket # Demo code for listening two hotwords at the same time interrupted = False ws = websocket.WebSocket() ws.connect("ws://localhost:42000"); def signal_handler(signal, frame): global interrupted interrupted = True def interrupt_callback(): global interrupted return interrupted if len(sys.argv) != 3: print("Error: need to specify 2 model names") print("Usage: python demo.py 1st.model 2nd.model") sys.exit(-1) def turn_on(): print("ON") ws.send("ON") def turn_off(): print("OFF") ws.send("OFF") models = sys.argv[1:] # capture SIGINT signal, e.g., Ctrl+C signal.signal(signal.SIGINT, signal_handler) sensitivity = [0.5]*len(models) detector = snowboydecoder.HotwordDetector(models, sensitivity=sensitivity) callbacks = [lambda: turn_on(), lambda: turn_off()] print('Listening... Press Ctrl+C to exit') # main loop # make sure you have the same numbers of callbacks and models detector.start(detected_callback=callbacks, interrupt_check=interrupt_callback, sleep_time=0.03) detector.terminate()
-
Autonomous Uploader (Platformio)
04/18/2017 at 08:48 • 0 commentsI'm currently working on an autonomous uploader so anyone can automate the production of usb devices.
Components
- a Raspberry Pi,
- a 16x2 LCD shield,
- (optional) a usb drive with devices repo from github.com/madnerdorg
- (optional) a smartphone/tablet to test the devices
- (optional) a 3D printer to make the case
Here is a prototype of this idea:
How does it works ?
Each github repo on github.com/madnerdorg/ have instructions for platformio.
On a terminal (with platformio installed) we can upload a sketch with this command:
platformio -f run -d /opt/arduino/test
platformio.ini
# Project Configuration File # Arduino IDE compatible version [platformio] src_dir = buzzer lib_dir = libraries [env:nano] platform = atmelavr framework = arduino board = nanoatmega328 targets = upload # lib_install =
I'm using a python script that will manage the lcd/buttons and run commands for platformio.
LibreConnect start at boot, and is stopped when a sketch is upload and then restart, once an arduino is programmed, it will be accessible as a websocket, ready to be tested.