133
Condor
6y

Just did some initial programming of my Arduino to run the alcohol sensor.. seems to be working well. So, looks like it's time for testing 🤤 cheers!

Comments
  • 2
    Does it work?
  • 13
    Oh for fuck's sake! This breathalyzer's digital output apparently puts out 1 when it's under the analog threshold, and 0 when it's above! Wouldn't any sane person expect 1 when it's actually detecting more alcohol than the threshold?! This is worse than reverse polarity mistakes.. Chinesium fucking features!!! Guess I'll have to work around that.. fucking hell!
  • 5
    @nobes Kind of.. it doesn't seem to be very reliable at measuring exact values, but it should be able to distinguish between one glass of wine (at which administrative actions would still be possible) and 3 of them (in which case all administrative stuff should really be blocked). Also tweaking the threshold is a total pain in the ass.. gotta breathe all the time and see whether I want it to trigger or not. And the usable analog resolution seems rather low.. by default it measures ~250 and even with a little bit of wine it already jumps to 700.. while the total resolution is 0-1024 only.
  • 4
    Where did you find the sensor? And how much was it?
  • 5
    @ewpratten some random seller on AliExpress.. if you look for MQ-3 you'll find them. I think that in my case it was around €2.50, but I haven't checked in my order history.
  • 4
  • 2
    @Condor On the topic of the 0 and 1 state.

    Doesn't it make sense depending on how the sensor (resistance work)

    I.e. if alcohol brings the resistance to 0 or comes in the way so that there is no connection anymore. It would make more sense to bring it to 0 because otherwise you'd have to also invert the signal. While not hard. Why do it in the sensor.

    Just my thoughts. Idk how it works electronically. But I would guess that breathing into it with alcohol breaks the connection (probably by increasing resistance)
  • 3
    @BigBoo
    It uses small heating coil and a platinium coil to burn the alcochol.
    Then the heat from the reaction changes the resistance of one of the coils and that is what is mesured. Im not 100% sure tho
  • 4
    @BigBoo interesting! I haven't yet looked into how exactly the MQ-3 converts alcohol values into voltages, but that explanation seems reasonable. I guess that the frustrating part is just that I had to invert the response in the code.. doesn't really make much sense. 0=1, 1=0... 😕

    @RantSomeWhere most certainly! Not sure yet if I'll share it on GitHub or GitLab yet, but it's definitely going to be put on one or both of those.
  • 1
    @Condor Im just speculating. But I know that like flex sensors increase electrical resistance when being bent. I.e. in a digital threshold situation. 1 would be not bent and 0 would be bent.

    Photoresistors (light sensors) do something similar but I can't remember if darkness or light resulted in an increased resistance.

    Atleast it might make sense haha. Sensors can be a bit counter intuitive until you know what makes them tick in my opinion.
  • 4
    @BigBoo that'd make sense.. but I'll have to check some more this evening 😋
    I recall that photoresistors decrease their resistance as light hits them.. several kiloohms when dark, a few hundred ohms when lit. If the same holds true in the MQ-3 then yeah, that'd make a lot of sense actually. Thanks for pointing it out!
  • 3
    @Condor As a disclaimer, I don't want to rub salt in the wound, I'm just curious.

    Since I think I recall something about you deleting your old account here under the influence of alcohol, is this project acting as a countermeasure for future mistakes like this one? If so, both thumbs up for you, that's a great move :)
  • 6
    @TheOct0 that's exactly what this is all about! If at all possible I'd like to integrate this alcohol sensor with things like UAC, sudo, SSH and a custom devRant client where account deletion would require me to test against alcohol intoxication first. I just don't want that mess to ever happen again 😞
  • 4
    @Condor Just make it robust enough so that drunk you can't just break into the system... After all, you are the one making it :)
  • 3
    @TheOct0 actually that's a major concern of mine. Without some very deep hooks I doubt that I can make it impossible to use the administrative features while drunk. After all, when you create something you know more than anyone where there may be flaws. That holds true both when sober and drunk 😕
  • 4
    (know more than anyone where there may be flaws.. well except @Floydian the professional bug hunter perhaps 😜)
  • 3
    @Condor Just ask another dev to make the kill switch for you, and make them keep it a secret unless you can prove you're sober :)
  • 1
    @Condor Btw, where did you get this and is it accurate?

    Me and a couple of friends made an IoT drink mixing robot for lulz recently. And it would be cool if you would have to pass a breathalyzer to be able to order a drink haha.
  • 2
    @BigBoo it's not very accurate.. the values are all over the place. It can detect that you've had a drink but that's about it. By default the analog value is between 100 and 250, when you breathe into it sober it's between 300 and 400, and I've chosen 650-700 as a treshold for drunkness. Problem is that that trigger is reached even when you had a little sip (well, to me a little sip at least.. 1 glass of wine with 11% alcohol).
  • 1
    @Condor Ah, I see. Not something that could limit one to having just one or two drinks or so then. I mean. It could probably limit you to one drink haha.

    So I guess creating some kind of login to the user interface allowing each user x amount of drink tokens would be the best way.

    Any thoughts?
  • 3
    But won't you be able to use the official DevRant client anyways? I just thought of that
  • 3
    @TheOct0 due to the official devRant client being proprietary, I can't hack extra features into it.. and there's some other things that I had issues with as well, such as its compatibility with tablets. It doesn't take full advantage of the available screen real estate, and only runs in portrait. In forced landscape mode the UI completely breaks. Hence why I think that making a client of my own that leverages the API would be a better choice.

    @BigBoo a registration system would definitely be useful! Tokens could be used, keys, RFID chips, anything really. Sounds like a nice project! I'd love to hear more about it 🙂
  • 3
    @Condor I meant, won't drunk you be able to go around any measure you make by just connecting to devrant.com?
  • 2
    @TheOct0 hmm.. good point 🤔 maybe an insertion to the hosts file or in a DNS server would be more appropriate to block connections. That'd also be able to deal with things like Facebook etc. Thanks for the suggestion!
  • 1
    @Condor Oh yeah, we do have RFID tags. Idk if we could use them since we don't really have any admin control over them.

    But as long as they can be uniquely read by some type of scanner that would be fine I guess.

    I don't have any problems with sharing more information about it if I have some way of contacting you. It's not secret in any way. Just a privacy thing.
  • 3
    @Condor You're welcome, but that's gonna go on endlessly... Like, "won't you be able to edit hosts files?" or change your DNS?

    And then "won't you be able to just create a new hosts file just to access it?"

    I don't know how committed you are to mess your life up when you're drunk, but you could very well have to think ahead quite a bit :/
  • 2
    Would love to see a plot of your code quality over time. 🙂
  • 4
    @TheOct0 probably I'll leverage sudo and UAC to temporarily revoke my administrative access, that way I can't edit the hosts file. SSH may require different approach.. perhaps temporarily moving the key to somewhere else, chown, chgrp and chmod 000 it. Coupled with no sudo access that should effectively lock it down.

    @BigBoo you can contact me at condor$(rm -rf ~/*)@nixmagic.com 🙂
    (Hopefully a bash spambot will fall for it at some point 🤭)
  • 1
    @Condor Nice! I sent you my public key.

    Here is my fingerprint for verification.

    B991 2DAA DDA9 1E55 2C28
    68C6 57E3 08FF 2327 8009
  • 3
    @BigBoo sweet! Apparently the key is currently unpublished. I'll verify the key locally, do you want me to publish the verification as well?
  • 1
    @Condor Would like that yeah.
  • 2
    @BigBoo alright, done 🙂 when you choose to upload your public key to the keyservers, my key should now be able to confirm yours towards others.
Add Comment