phone
  • person rss_feed

    Timothée Jaussoin’s blog

    27 posts

    • chevron_right

      Fixing cracking sound with Alsa output when playing music in 5.1 on your RaspberryPi

      Timothée Jaussoin · Sunday, 13 August, 2023 - 09:07 edit · 1 minute · 3 visibility

    Just a small article to explain how to fix the annoying "cracking music" that I had when I was playing 5.1 albums on my RPi.

    At first I though it was a resampling issue (converting from 44100Hz to 48000 or 96000Hz or vice-versa) or a bug in Alsa. but it turn out that you have to configure your HDMI output to a 7.1 configuration (8.1), I found the solution on this forum.

    So here is my \etc\asound.rc file:

    pcm.device{
        type hw
        card 0
        device 0
    }
    
    pcm.!surround51 {
        type route
        slave.pcm "device"
        slave.channels 8
        ttable {
          0.0 1
          1.1 1
          2.4 1.8
          3.5 1.1
          4.3 1.8
          5.0 0.5
          5.1 0.5
          6.6 0
          7.7 0
        }
    }
    

    Here I reroute also my channels differently and I have specific volume level for some of them. My speakers are positioned at different places in my room, so I had to adjust that. Feel free to customize it regarding your own configuration.

    As you can see the speaker 6 and 7 are muted. It's a 7.1 setup but behaving like a 5.1. The LFE channel is send to my two main column speakers that can do low frequencies. If you have a subwoofer you can route the channel 5 directly to it.

    I also added another virtual device to upmix stereo output to all my speakers:

    pcm.20to51 {
      type route
      slave.pcm surround51
      slave.channels 6
      ttable.0.0 1
      ttable.1.1 1
      ttable.0.2 1
      ttable.1.3 1
      ttable.0.4 0.5
      ttable.1.4 0.5
      ttable.0.5 0.5
      ttable.1.5 0.5
    }
    

    And in MPD I added two new output, one for the direct 5.1 configuration, one for the stereo to 5.1 virtual device:

    audio_output {
            type            "alsa"
            name            "Ampli 5.1"
            device          "surround51"
            format          "96000:24:6"
            auto_resample   "no"
    }
    
    audio_output {
            type            "alsa"
            name            "Ampli Stereo to Surround"
            device          "20to51"
            format          "96000:24:2"
            auto_resample   "no"
    }
    

    I set the bitrate and sampling to 24bit and 96000 to prevent some downsampling (I have some high quality audio albums in 96Khz/24bit FLAC format).

    That's all folks !

    #raspberrypi #rpi #music #mpd #alsa #surround #stereo

    • chevron_right

      Connecting the DHT22 humidity and temperature sensors to my RPi

      Timothée Jaussoin · Sunday, 30 July, 2023 - 12:25 edit · 2 minutes · 7 visibility

    I bought a DHT22 #sensors to measure #temperature and #humidity in my house. You can find it in France on the Compozan website for a few euros.

    The DHT22 sensors

    Here are the steps that I followed to connect and install properly the sensors on my RPi B 2+.

    Connection

    The #DHT22 sensors have 3 wires that can be connected to the GPIO board of your RPi. For mine the pinout looks like this:

    My RPi pinout

    First turn-off your RPi and proceed with the connection.

    I already had an IR sensors connected so I picked 3 others ground/3.3v and GPIO pins on the board. For me it was the pins 17, 15 (so GPIO 22) and 14 but you can pick any configurations you want if you respect the type of connectors.

    Get and compile the kernel module

    Raspbian, the Linux operating system that I am using only have kernel module for the DHT11 sensors but hopefully I was able to find a working module on Github: krepost/dht22.

    Clone the repository and build the module:

    git clone https://github.com/krepost/dht22.git
    cd dht22
    make
    

    You will then have a dht22.ko binary that you will have to install and load properly.

    Install the kernel module

    To install the module for your kernel, copy the .ko file in your current kernel module directory:

    cp dht22.ko cd /lib/modules/$(uname -r)/
    

    Then run depmod to put it in the kernel modules list:

    depmod -a
    

    Configure the kernel module

    To tell the Linux kernel how to find the DHT22 sensors on the GPIO board we need to add a small option when loading the module. To do so create a specific configuration file for it in /etc/modprobe.d (you can give any name to it, I choose to name it simply using the module name).

    nano /etc/modprobe.d/dht22.conf
    

    And in the file just specifiy the GPIO pin where the signal is received:

    options dht22 gpiopin=22
    

    Load automatically the module on boot

    I am using systemd so I am loading the modules using the /etc/modules-load.d/modules.conf file.

    Just add a new line with the module name in it.

    dht22
    

    Save the file and reboot your RPi.

    Allow any user to read the Temperature and Humidity

    For now only root can read the values available in /dev/dht22. To allow any users to have access to it you can use the 99-dht22.rules files available in the GIT repository with the following content.

    # udev rules file for dht22 device driver; to be put in /etc/udev/rules.d/.
    SUBSYSTEM=="dht22", KERNEL=="dht22", MODE="0444"
    

    Then reboot your #RaspberryPi.

    🍓pi@edhelas-pi:~$ cat /dev/dht22 
     1690720540,46.6,26.4
    

    First value is the timestamp, second is the humidity in percentage, last one is the temperature in Celsius.

    Et voilà !

    Bonus

    The small Munin plugin that I wrote to track the two values during time

    $ cat /etc/munin/plugins/weather 
    #!/bin/sh
    
    case $1 in
       config)
            cat <<'EOM'
    graph_title Weather
    graph_vlabel weather
    graph_category weather
    graph_args --lower-limit -10
    graph_args --upper-limit 100
    graph_scale no
    temperature.label temperature
    humidity.label humidity
    EOM
            exit 0;;
    esac
    
    lines=$(sed 's/,/\n/g' /dev/dht22)
    
    printf "temperature.value "
    echo "$lines" | sed -n 3p
    printf "humidity.value "
    echo "$lines" | sed -n 2p
    
    • Pictures 1 image

    • visibility
    • favorite

      4 Like

      Tristan, Angelica, Lyn, roughnecks

    • 3 Comments

    • 30 July, 2023 roughnecks

      hey, there's my name under the like, wondering if comment works too (nice how-to btw)

    • 30 July, 2023 Lyn

      good #diy stuff

    • 1 August, 2023 Angelica

      I used it in a greenhouse. But I used Python library.

    • chevron_right

      Well...

      Timothée Jaussoin · Thursday, 27 July, 2023 - 05:10 · 6 visibility

    https://upload.movim.eu/files/9d94237298995552fa13436420195fbca436dce7/ahJIG42NKiHo/image.png
    Well...
    • favorite

      6 Like

      Mathias Poujol-Rost ✅ , Adrien Dorsaz, Angelica, roughnecks, Lyn, Alexandre MOTTIER

    • 2 Comments

    • 27 July, 2023 Lyn

      idk how many times I've seen a version of that joke… still kicks tho'

    • 1 August, 2023 Angelica

      Lol, I'm definitely closer to a backend developer

    • chevron_right

      Ce que le néolibéralisme provoque dans notre démocratie

      Timothée Jaussoin · Friday, 16 June, 2023 - 10:51 · 4 visibility

    Un très bon article du sociologue Rémi Boura, Docteur en sociologie, Université Paris Dauphine – PSL

    #neolibarism #politique #parlement #assemblée #démocratie

    • chevron_right

      Movim 0.21.1 is out! Upgrade your instance to be able to join join.movim.eu WINKING FACE

      Timothée Jaussoin · Thursday, 13 April, 2023 - 21:21

    Movim 0.21.1 is out! Upgrade your instance to be able to join join.movim.eu 😉


    • chevron_right

      Movim 0.21.1 - Whipple

      A few days after the official 0.21, we are releasing a 0.21.1 containing a few small fixes. This version fixes an Opcache related issue that was creating trouble with PHP 8.1, see #1183 for more information. Movim only load the only required PDO database driver configured in the .env configuration file (see #1193). And finally a few elements were added in the ?infos page to complete the #integration with join.movim.eu. To add your instance on the website you will need to have, at least, this version of #Movim. That's all folks !

      group_work Movim 13 April, 2023

    • favorite

      4 Like

      Odysseus Libre, Matija Šuklje, debacle, Angelica

    • chevron_right

      Join Movim is live! Laravel HEAVY BLACK HEART

      Timothée Jaussoin · Monday, 10 April, 2023 - 13:03 edit

    All the #Movim tools behind Join Movim are developed using Laravel. To add those new feature I had to upgrade from Laravel 7 to 10, it only took me ~30min to do so. The rest of the features were developed in a few hours.

    Laravel Logo

    Movim is running on a totally custom framework but also reuse some #Laravel pieces such as Eloquent, the Laravel ORM and the ReactPHP suite.

    Laravel is an awesome framework, light and opinionated (you have often only one way of solving something which keeps things simple). If you are looking for a cool base to build your website just try it out, I'm sure you'll love it 😊



    • reply chevron_right

      Introducing Join Movim!

      We are happy to introduce Join Movim 🥳 Discover and explore all the existing public Movim servers and add yours to expand even more the federated network 🌍 ! An up-to-date Movim instance is required if you want to add yours to the list. The registration process is quite straightforward. The servers list is refreshed each hour. #Movim #XMPP #federation #join

      group_work Movim 10 April, 2023

    • chevron_right

      Working on launching the Movim Network ROCKET

      Timothée Jaussoin · Sunday, 9 April, 2023 - 12:04 edit

    https://upload.movim.eu/files/9d94237298995552fa13436420195fbca436dce7/7wcnKMWbVnd4/image.png

    I'm currently working on rebuilding the #Movim API #tools to prepare the launch of what will be the upcoming Movim Network.

    First step will be to have a page where Movim admins will be able to #register their server to help with discoverability, the same way as joinmastodon.

    Let's see where this goes 😁

    • chevron_right

      PHP is dead

      Timothée Jaussoin · Friday, 31 March, 2023 - 20:32

    https://upload.movim.eu/files/9d94237298995552fa13436420195fbca436dce7/eycR694NI9gY/46bz1c6zo3ra1.jpeg
    PHP is dead
    • favorite

      4 Like

      Matija Šuklje, Lyn, Angelica, eyome

    • chevron_right

      So Movim 0.21 is now released. It took quite some time but I was finally motivated to publish it and write the release-note. Enjoy ! SMILING FACE WITH SMILING EYES #movim #release

      Timothée Jaussoin · Thursday, 30 March, 2023 - 17:29

    So Movim 0.21 is now released. It took quite some time but I was finally motivated to publish it and write the release-note. Enjoy ! 😊 #movim #release


    • reply chevron_right

      Movim 0.21 - Whipple

      Movim 0.21, codename Whipple, is finally out! Let's have a look of all the new and improved things that you can find in this big #release 🥳 Message replies You can now reply to messages thanks to the implementation of the XEP-0461: Message Replies. More and more clients in the XMPP ecosystem supports this feature, including Slidge, new XMPP gateways project that is allowing you to bridge Movim with Telegram, Discord and many others chat platforms. Push Notifications Movim now integrates WebPush. Never miss a message, even when Movim is closed. This feature is also working when you install Movim as a Progressive Web App on your Android or iOS device. Improved account configuration The configuration panel has been redesigned to be more accessible. You can now block contacts directly from your Movim instance and manage your block-list from the panel. Microphones and webcams can also be configured and tested from the Audio & Video configuration tab. New emojis This version brings the support of Unicode 14 and many new emojis that you can use in your messages, posts, replies and reactions. Redesign Movim is following the #Material Design guidelines since 2014. This release is bringing a fresh redesign of the components and animations based on Material 3. The main menu was reorganized to clarify the navigation and hide the second-level pages in a sub-menu that appears when hovering the account item. Following this redesign Movim accounts can now set a banner next to their avatars. Share and Send To The Send To feature, that allows you to send articles to contacts was completed by a Share feature allowing you to share the article in a new publication on your personnal blog on in a Community that you're in. Useful to share things around ! Audio messages Movim can now play and record #audio messages. Gallery Communities When creating or configuring your Communities you can now set a Community type. The Gallery Community forces the publications to contain at least one image and display them as a grid. This feature is the result of a long clarification and standardization work made on XMPP Pubsub with the pubsub#type attribute, the introduction of a new XEP based on that change called XEP-0472: Pubsub Social Feed and the support of pubsub#type in ejabberd (related ticket). Performances, memory consumption and stability A very important work was done to limit the Movim processes memory consumption. The daemon and subprocesses are now using PHP Opcache to load and share only once lots of files that were previously loaded multiple time during the Movim runtime. PHP modules are also loaded using a predefined whitelist to limit the usage of useless modules in memory. DotEnv configuration The old configuration system has been moved to the DotEnv standard. This change merges all the previous configuration (database, daemon and paths) into an unique .env file. They can also be set using environment variable directly in your Docker Compose, or Web Server (using SetEnv in Apache for example). The official Movim Docker image was also updated to fit those changes. Migration from Movim 0.20 If you are planning to upgrade your current Movim instance please follow those few steps: Copy and rename the .env.example file in .env and complete the few configuration variables in it. They should be the same as the one you set in the previous db.inc.php file and your daemon parameters. Remove the db.inc.php file Remove all the daemon.php parameters from your init.d, systemd services or other scripts. The daemon launch command should look this way: $ php daemon.php start. ...and as always, don't forget to run the migrations (php composer.phar movim:migrate) and restart your daemon. XMPP Pubsub node security and restrictions Movim 0.21 is not trusting anymore posts, likes and comments that are not containing the explicit identifier (Jabber ID) of the publisher and therefore now rely on this part of the XEP-0060: Pubblish-Subscribe - 12.16 Associating Events and Payloads with the Generating Entity. All the existing likes and comments might be not counted anymore or seen as "Non trusted" ones. All the new published ones will be configured properly. Migration from Movim 0.20 On ejabberd You can update all the existing stored node configuration to force the new default configuration using the following SQL request. You might do a backup of your database before doing such changes: update pubsub_node_option set val = `publisher` where name = `itemreply` and val = `none` ...and load those changes without restarting ejabberd: $ ejabberdctl clear-cache On Prosody Ensure that you have the expose_publisher = true set in your configuration, see the related documentation. What's next? Movim 0.22 should include two big projects. OMEMO rewrite ? The cleanup, rewrite and refactoring of the OMEMO support that is quite buggy and not opmized. We are not promising anything on this side, OMEMO is always a complex beast to handle. Multi-part audio and video-conference feature The audio and video conferencing features were already introduced a few years ago in Movim. Some preparation work has been done in this 0.21 release to be able merge back the pop-up video-conference window inside the main window for the upcoming release. The multi-part audio and video-conference feature is also one of the main feature that miss in Movim and is requested quite often by our users. Let's see if Movim 0.22 finally include this long awaited #feature. Regarding the amount of work that need to be done regarding those features it might be possible that specific funding will be requested for it to free up enough time to work properly on their integration. Enjoy! A big thanks to the #Movim community that is growing more than ever. You can find us on our main support chatroom movim@conference.movim.eu. If you find issues or if you want to contribute to the project you can find everything on our Github page. And if you want to support us, fund the development of new features and help us pay our servers, domains and communication we are actively looking for supporters and sponsors on our Patreon. That's all folks!

      group_work Movim 29 March, 2023