ATmega328P 32.768kHz, sleep modes, and new schematic | binary watch

For the past week I’ve been debugging hardware and software to get my barebones ATmega328P to work with a 32.768kHz oscillator as Timer 2, which will tick outside of the sleeping microcontroller. This way I can keep track of time even as the microcontroller is off and saving power.

To get the 32.kHz clock to work was challenging, because I forgot some minor aspects of how to set the circuit up.

I ended up asking some questions on the Arduino Stack Exchange to really understand what I was doing and should do.

I wanted to test out Nick Gammon’s code, so I set up his example circuit:

img_5687

But it was still dorking out. The LED wasn’t turning on and off like I programmed it to do when waking up from sleep, and sporadically it would turn on really brightly, then off. Reaaaally weird behavior.

I took to UTW to ask about my problem, and as silly as it sounds, it turns out I forgot to program the microcontroller to use the 8MHz internal oscillator for the programmer!

Originally, the arduino bootloader has the fuse byte settings to use an external 16MHz clock. I needed to use the 8MHz internal clock for the processor. derp.

So, back to the drawing board of setting up fuse bytes by reprogramming the bootloader.

The circuit can be found in my previous posts: ATMega328P Burning the Bootloader

I ran into so many errors. All the following comes from my engineering log on GitHub:

I’m using the Arduino UNO to serially program the fuse bytes.

I ran:

avrdude -c arduino -p m328p -P /dev/ttyACM0 -v -U lfuse:r:h

which outputted this:

Using Port : /dev/ttyACM0
Using Programmer : arduino
AVR Part : ATmega328P
Chip Erase delay : 9000 us
PAGEL : PD7
BS2 : PC
RESET disposition : dedicate
RETRY pulse : SCK
serial program mode : yes
parallel program mode : yes
Timeout : 200
StabDelay : 100
CmdexeDelay : 25
SyncLoops : 32
ByteDelay : 0
PollIndex : 3
PollValue : 0x53
Memory Detail :

Programmer Type : Arduino
Description : Arduino
Hardware Version: 3
Firmware Version: 4.4
Vtarget : 0.3 V
Varef : 0.3 V
Oscillator : 28.800 kHz
SCK period : 3.3 us

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e950f
avrdude: Expected signature for ATmega328P is 1E 95 14
Double check chip, or use -F to override this check.

avrdude done. Thank you.

Alright, so looks like 0x0f vs 0x14 is messing up the reading of the device…
which is strange.

One answer from researching suggested to changed the baud rate.

“The thing that determines which you “talk to” is the baud rate. I believe that when you attempt to use ArduinoISP you need “-b 19200″ in your avrdude command so it won’t interact with the bootloader (Optiboot uses 115200 I think).”

I added “-b 19200” into my avrdude command, which produced the error:

avrdude: ser_open(): can't set attributes for device "/dev/ttyS0": Inappropriate ioctl for device

Looking further in that same forum, it appears the person having problems stated
that you can’t power the chip you’re programming with the same Arduino that is
programming it. Going to try an external power source for the chip before
exploring the “inappropriate ioctl” error.

With externally powering the chip, I made some progress! In which this was:

avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x00
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x00
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0x00
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0x00
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0x00
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0x00
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0x00
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0x00
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0x00
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x00

This person linked to another post which covered that through USB, the
arduino UNO doesn’t get enough power to read fuse bytes (very weird bug in the
hardware apparently), so I’m going to try feeding the external GND and VCC into
the arduino UNO as well.

That didn’t do anything, same error received.

Doing some more research, this problem could be a multitude of things:

* No communication between the PC and arduino
* ATMega328p UART/bootloader
* something is connected to RX/0 pin
* The AVR has been fused to need a very slow clock
* the AVR has its reset-disable fuse activated in its high fuse byte,
* the AVR has been fused to require an external clock or an external crystal.

I know the cord isn’t faulty, I can program other boot-loaded ATmegas with it.
Nothing is connected to the RXD0 pin, so I can rule that out as well.

I know I never fuse-byte programmed it, so the only remaining option could
be the bootloader.

I went about using OptiBoot to burn the bootloader on the ATmega328p, this
could potentially be the problem. I have some empty ATMegas, so I’m going to
attempt burning the regular bootloader on those to see if I can get any different
response.

While getting it set up, I ran into the error of ‘missing ‘bootloader.tool’ configuration parameter.
I found the solution here:
https://github.com/arduino/Arduino/wiki/Arduino-Hardware-Cores-migration-guide-from-1.0-to-1.6

So I need to add the lines:

arduino328bb.bootloader.tool=arduino:avrdude

to boards.txt. After that, Things *started* to run! Almost.
I got the error of an incorrect file path, so it couldn’t read the hex file. *hunts down file*
incorrect file path: ~/Downloads/arduino-1.8.5-linux64/arduino-1.8.5/hardware/arduino/avr/bootloaders/ATmegaBOOT_168_atmega328_pro_8MHz.hex

correct file path: ~/Downloads/arduino-1.8.5-linux64/arduino-1.8.5/hardware/arduino/avr/bootloaders/atmega/ATmegaBOOT_168_atmega328_pro_8MHz.hex

Instead of changing the path, I just moved the file to the directory it wanted.

Believe it or not, IT WORKED. WOOO.

Alright, this is great. One step closer to figuring this thing out.

With the newly bootloaded ATMega328p, I ran the command again:

avrdude -c arduino -p m328p -P /dev/ttyACM0 -b 19200 -U lfuse:r:-:h

which produced this error:

avrdude: stk500_getparm(): (a) protocol error, expect=0x14, resp=0x14

avrdude: stk500_getparm(): (a) protocol error, expect=0x14, resp=0x01
avrdude: stk500_initialize(): (a) protocol error, expect=0x14, resp=0x10
avrdude: initialization failed, rc=-1
Double check connections and try again, or use -F to override
this check.

avrdude: stk500_disable(): unknown response=0x12

I took out the “-b 19200” flag/value, and ran the command again, which returned:

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e950f
avrdude: Expected signature for ATmega328P is 1E 95 14
Double check chip, or use -F to override this check.

Apparently, people just suggested in this forum post to change the avrdude
configuration to recognize my ATmega’s signature XD Seems legit. Lets try it.
(https://www.avrfreaks.net/forum/difference-between-atmega328-328p-and-328pu?

whereis avrdude told me that my avrdude configuration file was in /etc/avrdude.conf

So I sudo vimmed into it, and found the ATmega328P entry on line 8681. I changed the signature to be: 0x1e 0x95 0x0f

And that sort of worked!
This was the output of that.

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e950f (probably m328p)
avrdude: reading lfuse memory:

Reading | ################################################## | 100% 0.00s

avrdude: writing output file “”
0x0

avrdude: safemode: Fuses OK (E:00, H:00, L:00)

…I’m not entirely sure that the fuses should be ’00’. In one forum post, they said part of the issue is avrdude using “safe mode”. To disable safe mode, I added a -u to the command:

avrdude -c arduino -p m328p -P /dev/ttyACM0 -v -u -U lfuse:r:-:h

Humm, that didn’t seem to do anything. The output file still reads “0x0”.
I am not entirely sure this is a huge issue, though.

So I did some research and found this great site: http://www.martyncurrey.com/arduino-atmega-328p-fuse-settings/

And it makes burning the fuses look really easy….so I’ma try it.

The fuses I need look like this:
L: 0x62
H: 0xD9
E: 0xFF

And he just adds an entry in “boards.txt” to take care of it. *genius*. Lets try this out…

#####################################################################

atmega328pbb.name=ATmega328P breadboard w/ internal 8MHz
atmega328pbb.upload.protocal=stk500
atmega328pbb.upload.maximum_size=32768
atmega328pbb.upload.speed=57600
atmega328pbb.upload.using=arduino:avrdude
atmega328pbb.bootloader.low_fuses=0x62
atmega328pbb.bootloader.high_fuses=0xd9
atmega328pbb.bootloader.extended_fuses=0xFF
atmega328pbb.bootloader.path=arduino:atmega
atmega328pbb.bootloader.file=ATmgeaBOOT_168_atmega328_pro_8MHz.hex
atmega328pbb.bootloader.unlock_bits=0x3F
atmega328pbb.bootloader.lock_bits=0x0F
atmega328pbb.build.mcu=atmega328p
atmega328pbb.build.f_cpu=8000000L
atmega328pbb.build.core=arduino:arduino
atmega.build.variant/arduino:standard

There’s my custom entry. Lets run it and see how that does.

The arduino UNO is still connected to my circuit, and still has the bootloader code on it. I got the same error as I did earlier:

Error while burning bootloader: missing ‘bootloader.tool’ configuration parameter

So I went back into boards.txt and changed this line:

atmega328pbb.upload.using=arduino:avrdude

to:
atmega328pbb.bootloader.tool=arduino:avrdude

restarted the ArduinoIDE, burned, and got this error:

avrdude: can’t open input file /home/thallia/Downloads/arduino-1.8.5-linux64/arduino-1.8.5/hardware/arduino/avr/bootloaders/ATmgeaBOOT_168_atmega328_pro_8MHz.hex: No such file or directory

..which I should’ve fixed that…oh derp. “atmega” not “atmgea”. *facepalm*.

:oooo no errors!! woohoo! Okay, so the fuse bytes *should* have been changed with that. Let’s see what avrdude did:

avrdude: verifying …
avrdude: 1 bytes of lock verified
avrdude: reading input file “0xFF”
avrdude: writing efuse (1 bytes):

Writing | ##############################################$
### | 100% 0.01s

avrdude: 1 bytes of efuse written
avrdude: verifying efuse memory against 0xFF:
avrdude: load data efuse data from input file 0xFF:
avrdude: input file 0xFF contains 1 bytes
avrdude: reading on-chip efuse data:

Reading | ##############################################$
### | 100% 0.01s
User configuration file is “/home/thallia/.avrd$
derc”

avrdude: verifying …
avrdude: 1 bytes of efuse verified
avrdude: reading input file “0xd9”
avrdude: writing hfuse (1 bytes):

Writing | ##############################################$
### | 100% 0.01s

avrdude: 1 bytes of hfuse written
avrdude: verifying hfuse memory against 0xd9:
avrdude: load data hfuse data from input file 0xd9:
avrdude: input file 0xd9 contains 1 bytes
avrdude: reading on-chip hfuse data:

Reading | ##############################################$
### | 100% 0.01s

avrdude: verifying …
avrdude: 1 bytes of hfuse verified
avrdude: reading input file “0x62”
avrdude: writing lfuse (1 bytes):

Writing | ##############################################$
### | 100% 0.01s

avrdude: 1 bytes of lfuse written
avrdude: verifying lfuse memory against 0x62:
avrdude: load data lfuse data from input file 0x62:
avrdude: input file 0x62 contains 1 bytes
avrdude: reading on-chip lfuse data:

Reading | ###############################################
### | 100% 0.01s

avrdude: verifying …
avrdude: 1 bytes of lfuse verified

avrdude done. Thank you.

duuuuuude.
how come I didn’t know it was this easy before?

lets test out the microcontroller now!

okay so looks like you actually have to have an “upload.tool” line in boards.txt or else it won’t let you upload a thing.
After that, it still wouldn’t upload, giving me that annoying “programmer is not responding/not in sync” error.

After looking around on Nick Gammon’s site, if the “divide by 8” fuse bit is set, you can’t upload programs…so now I gotta fix that.

I went and changed the fuse byte from 0xD9 to 0xE2, which changes the CKDIV8 bit. When burning the bootloader though, it has an error.

avrdude: verification error, first mismatch at byte 0x0000
0xc2 != 0xe2
avrdude: verification error; content mismatch

I wonder why it’s writing c and not e. Lets try programming it and see what happens.

oh crud. I changed the high fuse not the low fuse. Back to the boards.txt…..

okay, that fixed it. Phew, I thought I may have bricked it there for a sec. Now lets try programming it again…

Oops, it looks like it’s not actually using the bootloader, so it can’t upload the program. That would make sense.

This time I need to change the High Fuse byte to 0xD8 instead of 0xD9.
Testing program uploading again…..
and boom. It worked. 😀

turns out none of those were actually the errors lol, the UNO just needed its own atmega328p in it. *derp*

The test circuit worked, and it drew the expected amount of current. WOOOHOOOO.
major progress!

Now I have a working microcontroller, working code (aside from the buttons), and a full on new schematic!

binarywatchrev4.png

With this schematic (yes I know it’s ugly for now) I’ll generate the PCB, route the PCB, order some new parts, and then this project will be nearing its end.

Woo, that was a ton of work, but it totally paid off.

Happy hacking y’all!

{thallia}

Advertisements

Code – part 3 | Binary Watch

Last we talked about the Binary watch I was busy finishing up the second rendition of the working code and getting ready to complete the schematic.

As the date I head off to college comes nearer and nearer, the urgency of finishing my projects is heightening! And so I take to Spacemacs to venture through the depths of ATmega328P’s sleep modes, RTC modes, and more…

I roughly sketched out a nice schematic on EagleCAD that will soon be posted in my GitHub, but I gotta finish some hardware testing before that happens.

As for the code side of things, the next steps were to research sleep modules and see which ones work with my project set-up the best.

Reading through the datasheet is rather monotonous, it gave me a vague idea of what the sleep modules were, but I still had a hazy view of what I needed to do, so I headed over to the Arduino Stack Exchange.

My initial (albeit naive) idea was to keep the CPU, flash, and Clock running while putting all other modules to sleep. I started to test this, but disabling the modules had hardly no effect on the current pull of the ATmega328p, which was another reason I asked on Stack Exchange. One person said,

You do not want to keep the CPU running on a battery-powered project! You should use a timer for keeping the time, and let the CPU sleep. Ideally, you would connect a 32,768 Hz crystal to TOSC1/TOSC2 and have Timer 2 work in RTC mode. I have a clock running since June 2012 on the same pair of AA cells using this low-power technique.

This piqued my interest, so I went to research heavily on what RTC mode was, and how this stuff works alongside a sleep mode.

RTC stands for Real Time Clock, which is typically a 32.768kHz crystal externally connected to TOSC1/TOSC2 or XTAL1/XTAL2 pins. This RTC mode allows the entire microcontroller to sleep, while still ticking the external clock outside the sleep mode. With SLEEP_MODE_PWR_SAVE, the second-to-lowest power saving mode, you can wake it up through either a timer interrupt or a signal on the INT0/INT1 pin.

This seemed like the best solution, but how to implement it?
I have found *tons* of different code and libraries for this, so much so that I just got confused.

After much research and questioning, I came to two conclusions, of which I will try both:

1) Write code to work with an RTC/IC, like the DS1307 and code from this arduino library, that way I don’t have to mess around with setting all the hardware bits and bytes and confusing myself to no end. (more documentation on the arduino library here) It seems as though the DS1307 is a plug’n’play device, as long as you get the code right.

2) [as of 3-15-17 at 23:19] Test out Nick Gammon’s response on my Stack Exchange question. The code he gave me was very insightful with accomplishing all the bits and bytes and changing the hardware registers.

I have ordered some 32.768kHz crystals and the DS1307 board, both of which should come this Monday. In the meantime, I typed up some quick code to go with the DS1307, and adjusted the code from stack exchange. Both compile normally, so we’ll have to see how it works out when the actual hardware arrives. I’m sure mass debugging will entail…

Depending on which one works best for my purposes, I’ll adapt the schematic to the design and then start work on the PCB.

{thallia}

Connecting the Webserver to A Domain

Over the past week I have dedicated an insane amount of hours to getting this wordpress blog ported to my other domain. To do this, I had to set up a web server and redesign the website in HTML/CSS format.

To do this, I didn’t want to have to learn HTML, so I use a “wysiwyg” What You See Is What You Get HTML site generator, where you do all the design and it generates HTML code for you. I used BlueGriffon, and by far a great tool than some of the other wysiwyg things I found out there. BlueGriffon has a fairly smooth user interface, and an easy way of configuring things to the way you want them.

I used the Site Wizard’s tutorials on how to use BlueGriffon to generate a fully functioning website. His stuff is super thorough, so if you have absolutely no technical knowledge at all you’d be able to follow his stuff very easily.

I figured the best way to share files between my server and computer for now would be a GitHub repository. This repo stores all my sites files, so I can edit them on my computer, push to the repo, and pull on the server to put the changes in effect. Supes ezpz.

Now, to actually get the domain working with my server:

I didn’t have git or tmux installed, so that was the first pit stop. Since I’m using FreeBSD 12.0-CURRENT, there are no packages that are updated for the OS (since it’s a developers version, you have to install everything by hand. Even the package manager.

Anyway, to install git, cd /usr/ports/devel/git
Then:
sudo make
sudo make install
sudo make clean

The next step was to fix the DocumentRoot in two files, so my domain knows where to access the site files.

First, change DocumentRoot in /usr/local/etc/apache24/httpd.conf,

I git cloned thalliastree into apache’s data repo, so the path I put in DocumentRoot was:

DocumentRoot       /usr/local/www/apache24/data/thalliastree/

Also update the <Directory "path/here"> thing to have the same path as DocumentRoot.

Inside the <Directory "/usr/local/www/apache24/data/thalliastree/"> code block, you need to specify the initial index file that will pop up on your screen when someone accesses your site, which looks like this:
DirectoryIndex index.html

Where index.html is the homepage file for your site.

We need to update the path of one more file:

sudo vim /usr/local/etc/apache24/sites-available/bsd.lan-ssl.conf

Find the DocumentRoot line, then update the path to be the same as the one you updated earlier.

After that, everything should be ready to go, if you followed my other blog post: Setting up A Web Server on FreeBSD 12.0-CURRENT

Run sudo service apache24 restart on your webserver, direct a browser to your domain, and viola! Your newly designed website should appear 🙂

I had a problem where I couldn’t access my website from inside my network, which was partly fixed by adding an entry in /etc/hosts.

Now that this is all over, I can debut my new site, stay tuned for a blog post about moving to my newly hosted site 🙂

{thallia}

Setting Up A Web Server on FreeBSD 12.0-CURRENT

A project I’ve been meaning to accomplish before college is setting up a web server on my home server to host my blog. Now that I successfully got the wifi and ZNC working, I can get into some more exciting things!

My first task was to find out how to get a web server running on FreeBSD 12.0-CURRENT. This was pretty easy.

(make sure you have root permissions before proceeding)
portsnap extract
portsnap fetch update
cd /usr/ports/www/apache24/
sudo make install clean

You’ll have to wait a while after that last command, so be patient. This should get apache24 installed on your server. Often it may stop and ask you a few questions while installing, hit OK or Y to continue with the settings. Seriously, it took around an hour on my computer, so find something entertaining to learn or do while you wait!

Once that’s finished, sudo vim /etc/rc.conf and add the line apache24_enable="YES". Save and quit.

Next, cp /usr/local/etc/apache24/httpd.conf /root/httpd.conf.bak
Then, sudo vim /usr/local/etc/apache24/httpd.conf

Make ServerAdmin the email address you would like the server to send emails to if it encounters errors, and the ServerName as your IP address:port:

ServerAdmin you@emailaddress.com
ServerName Ip.Addr.Number:80

After setting that up, I thought it wise to set up security type things before I put any data onto the domain I bought. From research and talking with UTW, setting up HTTPS seemed like the best idea.

Before I get that set up, though, I needed to get my domain to stop pointing at NameCheap’s servers and point to my server.

I went into NameCheap, found my domain, clicked on Advanced DNS and under the first option, Host Records you add 2 new A records.
One should have the host as @ and your IP address following that, and the second one should have the host as www with your IP address.
Make sure to delete the CNAME record that directs it to namecheap, as well.

screenshot

(pardon my terrible mouse-handwriting.)

 

Next is setting up the SSL/TTS security stuff. We’re going to make a few directories, first.

mkdir /usr/local/etc/apache24/sites-available
mkdir /usr/local/etc/apache24/sites-enabled

Then we’re going to add a line into our configuration file:

sudo vim /usr/local/etc/apache24/httpd.conf

and add IncludeOptional etc/apache24/sites-enabled/*.conf underneath the ServerName line.

Now we need to enable the TLS module for Apache,

sudo vim /usr/local/etc/apache24/modules.d/020_mod_ssl.conf

and add these lines:

Listen 443
SSLProtocol ALL -SSLv2 -SSLv3
SSLCipherSuite HIGH:MEDIUM:!aNULL:!MD5
SSLPassPhraseDialog builtin
SSLSessionCacheTimeout 300

Save and quit, now head back to /usr/local/etc/apache24/httpd.conf and uncomment the line LoadModule ssl_module libexec/apache24/mod_ssl.so.

Now we need to create a TLS configuration file:

sudo vim /usr/local/etc/apache24/sites-available/bsd.lan-ssl.conf

And add:
screenshot.png

Don’t forget to update the places that say yourdomain.com with your actual domain name.

Finally, we can move on to Let’s Encrypt! cd into /usr/ports/security/py-certbot and sudo make install clean. After it compiles, run sudo pkg install py27-certbot py27-acme.

Once complete, you can use this command to generate your certificate!

certbot certonly --webroot -w /usr/local/www/apache24/data/ -d yourdomain.com -d http://www.yourdomain.com

When generating my certbot certification, I ran into an error:

Detail: No valid IP addresses found for yourdomain.net

To fix the first one, I had to change a record from A + DNS to a singular A record. Next, I made sure to port forward ports 80 and 443 on my router.

If you’re not sure how to port forward, find your local IP address and enter it into your browser. That should take you to your ISPs home page, where you can log in. From there, click around in settings until you find Port Forwarding options, and set up forwarding for HTTP(port 80) and HTTPS (port 443).

I also ran into the error that says, Error getting validation data. This was fixed by making sure the CNAME record in namecheap’s domain records was deleted.

Now we need to update the certificates in the configuration file.

sudo vim /usr/local/etc/apache24/sites-available/bsd.lan-ssl.conf and add these certificate lines:

SSLCertificateFile "/usr/local/etc/letsencrypt/live/yourdomain.com/cert.pem"
SSLCertificateKeyFile "/usr/local/etc/letsencrypt/live/yourdomain.com/privkey.pem"
SSLCertificateChainFile "/usr/local/etc/letsencrypt/live/yourdomain.com/fullchain.pem"

I got a few errors with these too, so make sure you have the right directories when you put them in the configuration file.

Then we’ll create a symlink for the sites-enabled directory, so TLS can find your cert files.

ln -sf /usr/local/etc/apache24/sites-available/bsd.lan-ssl.conf /usr/local/etc/apache24/sites-enabled/

Make sure there are no syntax errors:

apachectl -t

then sudo restart apache!

sudo service apache24 restart

Now to see if it actually worked. Run sockstat -4 | grep httpd, which should output something like this: screenshot.png

If that is what your output looks like, then time to celebrate!

My only error so far is that I cannot load my webpage from within my home network. I can access it outside of my home wifi network and others can access it as well, but other than that I have no access. Which is rather strange, but I’ll figure that out soon.

Next steps: find out how to get my blog on this thing.

{thallia}

i3wm Setting up backlight and sound

When moving to i3 window manager, my backlight and sound keys got disabled. This is a super simple fix.

Get to your i3 config in .config/i3/config, and enter these lines for the backlight:

# audio
bindsym XF86AudioRaiseVolume exec --no-startup-id pactl -- set-sink-volume 0 +5%
bindsym XF86AudioLowerVolume exec --no-startup-id pactl -- set-sink-volume 0 -5%
bindsym XF86AudioMute exec --no-startup-id pactl set-sink-mute 0 toggle

and enter in these for brightness:

bindsym XF86MonBrightnessUp exec "bash -c 'expr $(cat /sys/class/backlight/intel_backlight/brightness) + 100 | sudo tee /sys/class/backlight/intel_backlight/brightness'"
bindsym XF86MonBrightnessDown exec "bash -c 'expr $(cat /sys/class/backlight/intel_backlight/brightness) - 100 | sudo tee /sys/class/backlight/intel_backlight/brightness'"

Viola! Everything should work now 🙂

{thallia}

P.S. I have a discord server where we discuss and solve problems like this! Come join us and create a digital hackerspace community 🙂 Join here!