Connecting to Wi-fi

I am just starting to look at using balenaSound to make a multi-room sound set up.

I have a rasberry pi 3+ that I want to use as the host and then several rasberry pi zero w to use for the clients.

I am having a problem getting either of the devices to connect to the balena dashboard over wifi. With ethernet connected the Rpi 3 connects perfectly.

I am using a netgear router and the 2.4GHz band is using WPA2-PSK[AES] security. I tried to search on the forums for a similar situation but it was all frankly over my head…

I am completely new to all of this so any advice and assistance would be greatly appreciated! Thanks!

1 Like

Hey there,

Are you adding the WiFi Credentials to the image before downloading it?
If you do not want to re-flash your card, and want to check if the Credentials are correct, you can plug your SD-Card into another PC or connect via SSH.

  • There is a partition called resin-bootand inside a folder called system-connections
  • inside there you should find a file called resin-wifi-01 (or something like that)
  • In that file you will see a few blocks, one of them being [wifi] and another one being [wifi-security] there should be the ssid and the psk saved

Are you only seeing this behavior on the RaspberryPi3 or in the Pi Zeroes as well?

Another idea we have, is for you to try the wifi-connect project to see if your devices are all working properly:

I hope this helps, get back to us if you need more assistance!

1 Like

Yes - I added the WiFi credentials to the image before downloading it. Both are not showing up on the Balena dashboard. The Rpi 3 does show up and seems to be working correctly on the dashboard when using an ethernet cable.

I looked in the boot>system-connections>resin-wifi-01 folder and it has the following for both Rpi zero and Rpi 3:

"[connection]
id=resin-wifi-01
type=wifi

[wifi]
hidden=true
mode=infrastructure
ssid=MYNETWORKNAME

[ipv4]
method=auto

[ipv6]
addr-gen-mode=stable-privacy
method=auto

[wifi-security]
auth-alg=open
key-mgmt=wpa-psk
psk=MYNETWORKPASSWORD"

Does that look right?

it looks correct to me, If your credentials are correct (lower/upper case is important), then plug your ethernet cable and SSH into host (from your computer or balena cloud dashboard). Once there run nmcli con show --active and post here the output of that command. That should tell us if the wifi (resin-wifi-01) is connecting when the ethernet is connecting

Ok the Rpi 3 is showing this

image

ok, so your wifi is definitely not coming up, not even with ethernet (we have had that case, I wanted to rule it out)
I have a few questions to get a better picture:

  • Which device type have you selected for the Application ? In balenaCloud, under applications, inside the balena-sound button you should see the tag architecture, what does it say? this should not be armv7hf and not aarch64
  • Which OS Version and Supervisor Version are you using?

The only place I see anything about architecture is on the Applications page where it just says “rpi”

When i created this application i selected Raspberry Pi (v1/Zero/Zero W) as the default device type. I had read on here that you had to start like that to be able to add Pi Zeros as clients…
image

OS version: belenaOS 2.67.3+rev4
Supervisor Version: 12.3.0

Hey there, from your screenshot it looks like you created the correct App arch type for Pi Zero (rpi) but this would not be the type for your Rpi3 by default (though it may still work). When you downloaded the OS for your Rpi3 on the dashboard did you select the device type manually in the dropdown?
The difference is the App architecture (shown in your screenshot) is the default architecture used when building your application containers (rpi|armv7hf|aarch64). The device type when downloading the OS must match your device in order to boot correctly and have device drivers loaded. Select the device in the app dashbaord and the Device Type will be shown and it should be Raspberry Pi 3.

Thanks for all the quick replies! I am just trying to figure out if this will work for my project.

I created a few different “application” and this one (mispelled) “Baldena” is the one that I created with the default Raspberry Pi (v1/Zero/Zero W) as the default device type. But when I did the “add device” process to create the image I chose the Pi 3 to create the image for the Pi 3 and then chose Pi Zero to create the image for the Zero.

Inside that application it looks like it recognizes the Pi3 as a Pi3…

Is there a better way to accomplish my end goal? I basically want to use the Pi 3 to connect to and then it would send out audio signal to the Pi Zero’s in multiple rooms over the WiFi.

What you have so far looks correct to me. We may run into issues when actually deploying the sound containers to a mixed fleet (rpi vs armv7hf) but we aren’t even getting Wifi right now so one step at a time!

While the Pi3 still has ethernet access, can you try printing the NetworkManager logs to see if there is an indication as to why wifi is not working?

journalctl -u NetworkManager

OK - I just happened to have two Zero W from another failed attempt at this so that is what I’m starting with… I see that I may have to upgrade eventually.

anyway here is the result of
journalctl -u NetworkManager on the pi3 over ethernet…

I think you may still be able to use the Pi Zero (though I don’t have one to test with) but you may end up needing two apps, one for each architecture. Not terribly convenient but just to make sure the containers match the device arch.

Either way, we still have a Wifi issue to figure out before then. Can you hop into the dashboard and run device diagnostics? Both the Device Health Checks and the Device Diagnostics could provide a bunch of useful information without us asking you to copy-paste a dozen commands. I’m not sure if you’re able to attach a file in the forums, but if you can the diagnostics can be downloaded to a file and that would be the most useful.

Unfortunately I don’t think I can upload the file… I opened them and copy/pasted the results from the Device Health Checks below:

{“diagnose_version”:“4.20.23”,“checks”:[
{“name”:“check_balenaOS”,“success”:true,“status”:“Supported balenaOS 2.x detected”},{“name”:“check_container_engine”,“success”:true,“status”:“No container_engine issues detected”},{“name”:“check_localdisk”,“success”:true,“status”:“No localdisk issues detected”},{“name”:“check_memory”,“success”:true,“status”:“75% memory available”},{“name”:“check_networking”,“success”:true,“status”:“No networking issues detected”},{“name”:“check_os_rollback”,“success”:true,“status”:“No OS rollbacks detected”},{“name”:“check_service_restarts”,“success”:true,“status”:“No services are restarting unexpectedly”},{“name”:“check_supervisor”,“success”:true,“status”:“Supervisor is running & healthy”},{“name”:“check_temperature”,“success”:true,“status”:“No temperature issues detected”},{“name”:“check_timesync”,“success”:true,“status”:“Time is synchronized”},{“name”:“check_under_voltage”,“success”:true,“status”:“No under-voltage events detected”}]}

The results from the Device Health Checks is too long and contains lots of Links so I can’t paste it here… Is there a particular section that I could copy/paste?
Here is one section that might be interesting:
“NetworkSettings”: {
“Bridge”: “”,
“SandboxID”: “9fd46c8445a4fde27903c7baacaf85981b94b35f0ab3ed9c721659a7fcd21525”,
“HairpinMode”: false,
“LinkLocalIPv6Address”: “”,
“LinkLocalIPv6PrefixLen”: 0,
“Ports”: {},
“SandboxKey”: “/var/run/balena-engine/netns/default”,
“SecondaryIPAddresses”: null,
“SecondaryIPv6Addresses”: null,
“EndpointID”: “”,
“Gateway”: “”,
“GlobalIPv6Address”: “”,
“GlobalIPv6PrefixLen”: 0,
“IPAddress”: “”,
“IPPrefixLen”: 0,
“IPv6Gateway”: “”,
“MacAddress”: “”,
“Networks”: {
“host”: {
“IPAMConfig”: null,
“Links”: null,
“Aliases”: null,
“NetworkID”: “9b3ec005a1de369f00e324d58de64f9d112358982927235b51f1362d35bd15ab”,
“EndpointID”: “704adfcd8a3aa9059be0beb360c80991666223510707aa4a6ecd5ed8ef7ef756”,
“Gateway”: “”,
“IPAddress”: “”,
“IPPrefixLen”: 0,
“IPv6Gateway”: “”,
“GlobalIPv6Address”: “”,
“GlobalIPv6PrefixLen”: 0,
“MacAddress”: “”,
“DriverOpts”: null
}
}

Thanks for plugging away at this. Let’s try this to rule out a few things.

Can you start fresh so each application is building balenaSound for the correct architecture of your device? e.g. Create one application meant for Pi3 and add your Pi3 to that. Create another one for the Pi zeros and add the zeros to that.

Be sure to carefully input your wireless SSID and password during the Add Device step and definitely be sure to specify that you’re adding the correct device to each app (Pi3 for the Pi3 setup, Pi Zero for the Pi Zero setup).

Power on your devices and let’s hope to see each application populate with their respective devices. Curious to see if all your devices behave as they should in both of these applications with a solid, fresh (and correct) start.

Ok - Sure. I was under the impression that I had to have all the devices in the same application to get them to connect to each other. Sounds like that is not the case! I will report back when I have two separate applications flashed and on the pi’s.

ok I have created two fresh applications with SSID and password and flashed the SD cards respectively. It still looks like the same issue. The Pi3 is connected over ethernet, but no WiFi and the Zero does not show up at all (so no WiFi). Is there some setting to check on my router to make sure that they are able to connect via WiFi?

here are the results of journalctl -u NetworkManager:

Hi

This is a slight diversion, but can you try the WiFi connect app instead of configuring the wifi credentials from the dashboard. I am curious to see what you see when you scan for WiFi networks.

The WiFi connect service let’s you configure the WiFi credentials at runtime, instead of during OS configuration. I have a suspicion that the device isn’t able to see the WiFi networks and thats why we are seeing this behaviour.

ok I am down to try this, but i really don’t understand how to use the wifi connect… Am I supposed to add the wifi-connect-master folder to the SD card image that I created with the Balena Cloud “Create Application>Add Device” ?

Hi there,

you just need to add a folder in the same directory as your docker-compose.yaml called wifi-connect and inside the folder the Dockerfile template:

in your .yaml file, add wifi-connect as a new service

wifi-connect:
    build:
      context: ./wifi-connect
    restart: always
    network_mode: host
    privileged: true
    labels:
      io.balena.features.dbus: '1'
      io.balena.features.firmware: '1'

once you do that, then push the code to your application and once it builds, you’ll be able to test your device’s wifi-connectivity, where it will create it’s own access point. There you could also configure the credentials.