"something I made" thread

No flash here just function thats all that matters to me

2 Likes

Just joking around. Same page.

2 Likes

Yeah i know, those things always crack me up. Like gold plated ak’s and whatever, most people would only see the business end of any of mine anyway.

3 Likes

Lol if there’s any gun I’d ever own that’s gold plated it’d be an AK with custom furniture.

2 Likes

Love my custom furniture, just dont see the need for all the other stuff. To each there own, they do look cool.

2 Likes

underpotential deposition is a thing…

I’ve got one of those same Corsair RGB mouse pads. My daughter is entranced by it every time she comes into my office.

2 Likes

It’s funny but the LED mouse pad type things are literally the exact type of “lets slap unnecessary lights on” object I’d normally talk hella shit about…BUT OOOH IT’S GOT A USB PORT TOO NEVERMIND NOW IT’S AMAZING!

I’ve been working on an openhab server/config/layout for about a week now, still in the formative steps of getting used to it all but the objective is to get all the Office lights to play nice together - Sengled wifi bulbs in the ceiling fan, hue bulbs/led strip in other parts of the office with full led lighting on the cpu case/mousepad/mouse so the idea is to synchronize them all via openhab for my “practice” project (may need an IOT wifi hub for it to connect without my phone present though even though it says no hub needed…my ass). I haven’t had a whole lot of time to work on it so it’s been slow-going but my god the possibilities are huge in it.

After that works out I want to make a more comprehensive layout that’s designed for an old tablet screen and only a tablet screen - essentially the endgame being most home automation and even a diagnostic screen for a grow room. I am bad at coding though so…who knows!

1 Like

That was pretty much my exact reason for buying this one, and it was on clearance for like $25. I hate to admit how much I enjoy RGB LEDs, but I’d be lying if I said I didn’t have a big ass bag of them behind me that get used in various projects. I’ll have to check out openhab.

2 Likes

My office is like a fucking disco…I am a large child. Hell, I even got an audio EQ setup on the LED keyboard! Favorite thing i’ve done with it so far other than animate an LED heart monitor thingy across the keyboard!

I swear to god the majority of the reason i’ve been working so hard to make my car badass is so I’m not embarassed to put LEDs underneath it, haha

4 Likes

That’s like gold plating a hammer to me… I mean, I just don’t do things like that to my tools.

1 Like

Smart Man right here!

one little project I have going right now is a Bluetooth speaker built into a bench. The speakers are car speakers I had lying around and are powered by a 12V car amp which I power with a meanwell 300watt psu. The brains is an rpi2. The pi hosts a rest api on my local network. I can send requests like turn on, turn off, volume up, next track, etc to the API, which is then making system calls to the rpi to launch a Linux app called random play that I actually use to play the music.

The nice thing about the rest api is it’s a backend interface that’s abstracted. All I need to do is send a proper http GET request to my api and it will do the rest. The rpi then also hosts a simple web page which has buttons on it that you can click which then send out requests to the api. Also I have built a hardware controller out of a rpi zero that sends requests using python but since I built the website , which I can load from my phone or any computer on my network, the hardware controller is a nonstarter. The webpage interface is much more flexible.

I’d suggest considering this type of implementation for your tablet interface.

Edited to add the API script and raw html page (nothing fancy). I run the API script as a cron job at reboot. Easter egg audio included :stuck_out_tongue:

import array
import fcntl
import os
import sys

from subprocess import Popen, PIPE

from flask import Flask
from flask_restful import Resource, Api

from webargs import fields
from webargs.flaskparser import use_kwargs

class MuteVolume(Resource):
    def get(self):
        print "Muting volume"
        try:
            volume = str(0) + "%"
            Popen(["amixer","-q","sset","Master",volume])
        except Exception as e:
            return {"Internal Server Error": e.message}, 500
        return {"new_volume":"muted"}, 200

class SetVolume(Resource):
    args = {
        'volume': fields.Int(
            required=True,
        ),
    }

    @use_kwargs(args)
    def get(self, volume):
        print "Setting volume to:", str(volume) + "%"
        if volume < 0 or volume > 100:
            return {"Invalid volume":volume}, 400
        try:
            volume = str(volume) + "%"
            Popen(["amixer","-q","sset","Master",volume])
        except Exception as e:
            return {"Internal Server Error": e.message}, 500
        return {"new_volume":volume}, 200

class ToggleOnOff(Resource):
    args = {
        'on_off': fields.Str(
            required=True,
        ),
    }

    @use_kwargs(args)
    def get(self, on_off):
        if not on_off in ['on','off']:
             return {"Invalid request":on_off}, 400 
        print "Turning radio: ", on_off
        try:
            pgrep = Popen(["pgrep","randomplay"], stdout=PIPE)
            pid = pgrep.communicate()[0].strip()
            if not pid == "":
                print "randomplay pid:", pid
            if on_off == "on":
                if pid == "":
                    radio_args = ["randomplay","--basedir=/mnt/usb1/","--pause=0", 
                        "--quiet"]
                    Popen(radio_args, stdin=PIPE, stdout=PIPE)
                else:
                    return {"Invalid request":"Radio is already on"}, 400
            else:
                if not pid == "":
                    Popen(["kill","-9", pid])
                    pgrep = Popen(["pgrep","mpg321"],
                        stdout=PIPE)
                    pid = pgrep.communicate()[0].strip()
                    Popen(["kill","-9", pid])
                else:
                    return {"Inavlid request": "Radio is already off"}, 400
        except Exception as e:
            return {"Internal Server Error": e.message}, 500
        return {"Radio state":on_off}, 200

class PauseTrack(Resource):
    def get(self):
        try:
            pgrep = Popen(["pgrep","randomplay"], stdout=PIPE)
            pid = pgrep.communicate()[0].strip()
            if not pid == "":
                command = 'echo' + ' p' + ' >>' + ' /proc/'+pid+'/fd/0'
                os.system(command)
            else:
                return {"Inavlid request": "Radio is off"}, 400
        except Exception as e:
            return {"Internal Server Error": str(e)}, 500
        return {"track":"paused"}, 200

class ForwardTrack(Resource):
    def get(self):
        try:
            pgrep = Popen(["pgrep","randomplay"], stdout=PIPE)
            pid = pgrep.communicate()[0].strip()
            print "randomplay pid:", pid
            if not pid == "":
                command = 'echo' + ' f' + ' >>' + ' /proc/'+pid+'/fd/0'
                os.system(command)
            else:
                return {"Inavlid request": "Radio is off"}, 400
        except Exception as e:
            return {"Internal Server Error": str(e)}, 500
        return {"track moved":"forward"}, 200
    
class BackwardTrack(Resource):
    def get(self):
        try:
            pgrep = Popen(["pgrep","randomplay"], stdout=PIPE)
            pid = pgrep.communicate()[0].strip()
            print "randomplay pid:", pid
            if not pid == "":
                command = 'echo' + ' b' + ' >>' + ' /proc/'+pid+'/fd/0'
                os.system(command)
            else:
                return {"Inavlid request": "Radio is off"}, 400
        except Exception as e:
            return {"Internal Server Error": str(e)}, 500
        return {"track moved":"backward"}, 200
        
class PresentThem(Resource):
    def get(self):
        try:
            chunk = 1024
            f = wave.open("resources/wav/present_them.wav","rb")  
            p = pyaudio.PyAudio()  
            stream = p.open(format = p.get_format_from_width(f.getsampwidth()),
                channels = f.getnchannels(),
                rate = f.getframerate(),
                output = True)
                
            data = f.readframes(chunk)
            while data:
                stream.write(data)
                data = f.readframes(chunk)

            stream.stop_stream()
            stream.close()
            p.terminate()
        except Exception as e:
            return {"Internal Server Error": str(e)}, 500
        return {"speakerbenchAPI":"present them"}, 200

if __name__ == '__main__':
    app = Flask(__name__)
    api = Api(app)
    
    api.add_resource(SetVolume, '/set_volume')
    api.add_resource(MuteVolume, '/mute_volume')
    api.add_resource(ToggleOnOff, '/toggle_on_off')
    api.add_resource(ForwardTrack, '/forward_track')
    api.add_resource(BackwardTrack, '/backward_track')
    api.add_resource(PauseTrack, '/pause_track')
    api.add_resource(PresentThem, '/present_them')
    
    app.run(host="0.0.0.0", port=5050)




<html>
        <head>
		<link type="text/css" rel="stylesheet" href="./css/index.css"/>
        </head>
        <body>
                <header style=" width: 100%; height: 15%; background-color: orange; text-align: center;">
			<div style="width: 100%; height: 30%;"></div>
			<h1 style="float: center; margin: auto;">SpeakerBench API Controller</h1>
                </header>
		<section style="width:100%; height: 65%; background-color: tan">
			<div style="height: 5%; width: 100%; margin: auto auto;"></div>
			<div style="height: 95%; width: 60%; margin: auto auto;">
				<div style="height: 30%; width: 80%; margin: auto auto;">
					<form action="http://192.168.1.103:5050/toggle_on_off?" target="dummyframe" method="get">
						<input type="hidden" name="on_off" value="on" style="width: 100%"/>
						<button class="on_off_button" type="submit">On</button>
					</form>
                                        <form action="http://192.168.1.103:5050/toggle_on_off?" target="dummyframe" method="get">
                                                <input type="hidden" name="on_off" value="off"/>
                                                <button class="on_off_button" type="submit">Off</button>
                                        </form>
				</div>
        	                <div style="height: 5%; width: 100%; margin: auto auto;"></div>
                        	<div style="height: 30%; width: 30%; margin: auto auto;">
				 	<form action="http://192.168.1.103:5050/set_volume?" target="dummyframe" method="get">
						<label for="volumeSlider">Volume</label>
						<noscript><button type="submit">Set Volume</button></noscript>
                                		<input class="volume_slider" onchange="this.form.submit();" id="volumeSlider" min="0" max="60" name="volume" value="10" type="range" orient="vertical" />
                        		</form>
				</div>
        	                <div style="height: 5%; width: 100%; margin: auto auto;"></div>
                        	<div style="height: 20%; width: 80%; margin: auto auto;">
                                        <form action="http://192.168.1.103:5050/backward_track" target="dummyframe" method="get">
                                                <button class="track_button" type="submit">Previous Track</button>
                                        </form>
                                        <form action="http://192.168.1.103:5050/forward_track" target="dummyframe" method="get">
                                                <button class="track_button" type="submit">Next Track</button>
                                        </form>

                        	</div>
			</div>
                        <div style="height: 5%; width: 100%; margin: auto auto;"></div>
                </section>
                <footer style="width: 100%; height: 20%; background-color: brown;">
			<div style="width: 100%; height: 30%"></div>
                	<iframe name="dummyframe" id="dummyframe" class="dummy_iframe"></iframe>
		</footer>
        </body>
</html>

5 Likes

How about a substantially hot-rodded 1960s silvertone victrola?

13 Likes

Oh shit, you’re a nerd too!!! I like it!!!

I’ve been slacking on my projects this week, i’ve been busting my ass cranking as much bubble as my lil` flippers can make but I have a feeling i’ll be getting soooooo many raw materials from friends and family for christmas that something will be coming soon!

3 Likes

Someone should make a dog squeaky toy that operates on the dog whistle frequency.

2 Likes

I guarantee my little terrier hund would still murder it 30 seconds after she gets it!

4 Likes

It squeaks for them, but is silent for you. I think it’s brilliant.

3 Likes

Speaking of RGB leds, lasers are still technically still made with light emitting diodes, hella coherent collimated light. Ran out of hallway way too fast tho.

7 Likes


I pour baits sometimes I got lots of molds

12 Likes