Closed tcpipchip closed 2 years ago
Hi, yes, there are no dependencies to the raspberry pi versions, the zero will be slower though. The nRF52 firmware applications in this repo are experimental and meant for someone who would like to create something new with nRF52 and not meant as a ready to use application. Depending on what you need, I can recommend other frameworks like zigbee2mqtt for example. If you would like to do some advanced nRF52 projects then I recommend the new frameworks such as Zephyr as nRF SDK is quite inconvenient in comparision. I have recent examples here : https://www.homesmartmesh.com/docs/microcontrollers/nrf52/
The nRF52 communicate with the raspi through serial therefore both environments are quite independent only the serial protocol matters. Regarding the applications in the raspi folder, they are discontinued from this repo and evolved on a raspi dedicated repo where I cleaned up the environment add a lot of nodejs and python services also many docker containers. the repo is here : https://github.com/HomeSmartMesh/raspi If you have questions about it you can use the associated forum or ask on the related github repo as you wish.
@wassfila Thanks for you your fast Answer!!!!! Let me resume to make my tests, i will need an RASPBERRY PI connected to a NRF52840 by the USB (creating a UART). This UART will be used by RASPBERRY accept WIFI protocols (zigbee, openthread) send by my NRF52832/840 end devices, right ?
Thanks!
yes, Raspi <-> nRF is always UART, nRF52832 has uart pios only so you need a UART-to-USB adapter while nRF52840 has native USB so you could use a usb cdc driver and from Raspi side it won't make any difference. nRF52 between each other can communicate with either of Bluetooth, Zigbee, Thread over 802.15.4 or even custom RF. Although I can confirm your statements they're still a bit fuzzy to me. I can help you more if you explain your use case, are you a student, hoppy or startup ? What is the application you'd like to build ? or is it just for learning ?
Hi, I am teacher and work at www.furb.br about 34 years on science computation course. Teach Computer Architecture i and II and IoT. I work too to the smartcore, a u-blox representative in Brazil. My function is to write blog and support to them. Blog are to help the client to decide which better programming softwares tools to program our u-blox nrf52 modules. I see that we are lack of examples using “mesh” networks. Then I decided start soon write blogs about your integration and share your git. Here some of blogs, I hope your help soon! They will like your solution.
https://loja.smartcore.com.br/pagina/blog-faq-familia-nina-u-blox-wifi-ble.html
That's cool, I think for learning it's a good example as it pushes students to think about their own custom protocols which is an important step for understanding existing protocols. Existing protocols have so much work in them that people do not realize if they don't try their own. Feel free to use any of the content from the github repos I have and if you have any specific question or one of your students have, I will support slowly but surely to the extent of as soon as I have time in my free time, as I develop these in my free time. I recommend more to focus on "Zephyr" because it's the future, but if needed a fully functional mesh protocol then the nRF SDK is also good but just harder. I also recently started examples with UWB if that's interesting for you.
Thanks @wassfila Yes, I will use the zephyr to test! I don’t have here the raspberry, but I will try to use the virtual box raspberry VM in my pc, an nrf52840 connected to my pc and finally a nrf52832 make the wifi communication. I have to install the web application on pc, the usb cdc serial mesh software and on end device that gpio example. Will the raspberry detects the end device ? About UWB, needs special Antenna ? Let me know more about. Happy 2022
@wassfila hi, did you get success to install DOCKER on VIRTUAL BOX RASPBERRY ?
Docker is a container system that replaces the virtualization mechanism. Although virtualization operates between the hypervisor and the operating system and the container system between the operating system and the user space, I don't think they can be combined e.g. docker on virtual-box. You can install docker for windows but then you still have the dependency that the host and container need to be the same architecture. In other terms and to keep this simple, I think that raspi docker only runs on raspberry pi the easy way, unless someone is very advanced with virtualization and emulation and solutions might be complex. I use all my raspberry pi from a windows command line "ssh with putty" and access them even with VSCode editor through ssh. with that, once you have a physical raspverry pi on your local network, the rest is identical to work on windows environment (putty + VScode or even VSCode console on ssh raspi) I'm using VSCode "remote ssh" plugin
As an additional hint and from experience, as soon as something is not working with Docker "out of the box" then you'd rather leave docker away and debug with native environment otherwise the containerization just makes everything more complex, so make it run native first then move it to docker.
I currently configured 11 services running with docker on the raspberry pi. The more appropriate repo to open issues about it would be this one where the raspi services are maintained, this one is only for nRF firmware now. https://github.com/HomeSmartMesh/raspi/issues
Here you can see the docker-compose file I'm using https://github.com/HomeSmartMesh/raspi/blob/master/docker-compose.yml
To make first installs easier I created setup scripts to install docker and docker compose here https://github.com/HomeSmartMesh/raspi/blob/master/setup.sh if you want to call them one by one or see instructions and execute them manually one by one
https://github.com/HomeSmartMesh/raspi/blob/master/setup_docker.sh https://github.com/HomeSmartMesh/raspi/blob/master/setup_docker-compose.sh
Hi @wassfila I will test directly on Radpberry Thank you! Yes, it’s the better choice!!!
Got raspberry to start the tests soon! I hope this week!
Installing Will work on Raspberry zero w ? And wich Raspberry distrubution did you test ?
testing on other raspberry S.O
@wassfila
If possible, tryng to install on Rasp Zero W
Looks that not works good Some problem, got -Error when try to create a FORM -Looks that nothing is listening on 3000 port (grafeno)
`pi@raspberrypi:~/raspi$ sudo bash setup_thread_services.sh mkdir: cannot create directory ‘containers/grafana/data’: File exists Starting raspi_influx_1 ... raspi_mosquitto_1 is up-to-date Starting raspi_influx_1 ... error
ERROR: for raspi_influx_1 Cannot start service influx: driver failed programming external connectivity on endpoint raspi_influx_1 (56b6d930906c7c602c588e9b2be1bd1a427998f3458c4ccdb390ff07466c1e27): Bind for 0.0.0.0:8086 failed: port is already allocated
ERROR: for influx Cannot start service influx: driver failed programming external connectivity on endpoint raspi_influx_1 (56b6d930906c7c602c588e9b2be1bd1a427998f3458c4ccdb390ff07466c1e27): Bind for 0.0.0.0:8086 failed: port is already allocated ERROR: Encountered errors while bringing up the project. /home/pi/raspi/py/influx /home/pi/raspi Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple Requirement already satisfied: paho-mqtt in /usr/local/lib/python3.9/dist-packages (from -r requirements.txt (line 1)) (1.6.1) Requirement already satisfied: influxdb in /usr/local/lib/python3.9/dist-packages (from -r requirements.txt (line 2)) (5.3.1) Requirement already satisfied: requests in /usr/lib/python3/dist-packages (from -r requirements.txt (line 3)) (2.25.1) Requirement already satisfied: msgpack in /usr/local/lib/python3.9/dist-packages (from influxdb->-r requirements.txt (line 2)) (1.0.3) Requirement already satisfied: pytz in /usr/local/lib/python3.9/dist-packages (from influxdb->-r requirements.txt (line 2)) (2021.3) Requirement already satisfied: six>=1.10.0 in /usr/lib/python3/dist-packages (from influxdb->-r requirements.txt (line 2)) (1.16.0) Requirement already satisfied: python-dateutil>=2.6.0 in /usr/local/lib/python3.9/dist-packages (from influxdb->-r requirements.txt (line 2)) (2.8.2) mkdir: cannot create directory ‘/var/log/influx’: File exists /home/pi/raspi /home/pi/raspi/py/thread_tags /home/pi/raspi Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple Requirement already satisfied: paho-mqtt in /usr/local/lib/python3.9/dist-packages (from -r requirements.txt (line 1)) (1.6.1) mkdir: cannot create directory ‘/var/log/thread/’: File exists /home/pi/raspi pi@raspberrypi:~/raspi$ ls`
Installing Will work on Raspberry zero w ? And wich Raspberry distrubution did you test ?
I used raspbian on raspberry pi 4, also now raspberry pi os
If you're testing my raspi repository then I suggest to move the questions to that same repo there https://github.com/HomeSmartMesh/raspi/issues
It looks like you made good progress. But if you try something different, like different os or different pi version then you should test services one by one, and I would recomment to fallback on the official install of each service as they might have different scripts. For grafana, I'm having issues too, so you can keep grafana outside docker for now and install it native if you need.
we tested in 10 raspberry zero w (today in classroom)....using different OS...all has some of fail...
Well, i see that ZERO W is not a good option.
I will try soon with RASPI 3...
But why would you make students suffer with such difficult tasks ? Whizh service do you want to run ? Grafana ? Which data will you store in it ? Openthread ? Did you flash a nrf52 for it ? How old are the students, school or university ? Why don't you start with something simple like https://magpi.raspberrypi.com/books/beginners-guide-4th-ed
Hi @wassfila
How are you ?
I only asked him to start that Install Script to see if install without problem...
_curl https://raw.githubusercontent.com/HomeSmartMesh/raspi/master/get_raspi.sh -o get_raspi.sh sudo sh getraspi.sh
On ZERO, install 100% the openthread web server but got error during FORM register.
But on RASP 3 works nice!
Now, i can go to the next step, that is program the NRF52 with Zephyr and start commuication with Openthread
They are my student, University, i only asked them a help, because i was tryng differents OS and having a lot of problem in install.
But, really, i believe that ZERO is not good to this...too slow...
I will read that book! thanks
oh, now I see, uni students should be able to handle it and help you. I agree with the Zero you might waste too much time in case it works at all
Hi @wassfila
back to the tests! Now with RP3 :)
About this, error, some permission ?
I had that error quite a few times, that's usually the rcp dongle not responding, most likely wrong version flashed or rcp not connected. To debug that, you need to read the raspberry pi service log. I think it's "otbr-agent" service Check https://www.homesmartmesh.com/docs/networks/thread/#raspberry-pi
got progress using the u-blox NINA B302 as a USB dongle to RASPBERRY.... now forms works
what should be the next test ? create a Zephyr Node ? And wich the better and easy example to test on your list samples ?
Tips will be good :)
Nice, congratulations 👏
more progress
wich is the next procedure ?
i can join to the CHILD (u-blox nina b302) Can i ping to it using the RASP interface ?
@tcpipchip excellent you're becoming an expert in Thread. The raspberry pi offers a web interface but also a cli interface that is identical to what you have on the serial with nRF52, here see this section https://www.homesmartmesh.com/docs/networks/thread/#cli-on-border-router !!!! but be careful with it, you cannot run it at the same raspberry pi that is creating the border router !!!!, reason is that the rasp cli command ot-ctl conflicts with the web-gui service, I had often the issue that the after using ot-ctl the gui did not work. But in general to ping, the same commands can run similarly on serial console or rasp ot-cli, the list of commands here https://www.homesmartmesh.com/docs/networks/thread/#cli-reference
or here a direct link to the official repo doc of the ping command https://github.com/openthread/openthread/blob/main/src/cli/README.md#ping--i-source-ipaddr-size-count-interval-hoplimit-timeout
wich is the next procedure ?
Once you're done with unit testing thread commands on CLI, you can do either of the following :
@wassfila One question, In theory, i need 3 nrf52840 to tests
1) The NCP on RASPBERRY
2) A FTD that is commissioner
3) A FTP that is an JOINER, right ?
Is option 2) optional ?
or
can the Rasp be the comissioner too ?
Thanks!
@tcpipchip if you want to allow a device to join without directly giving it the master key, then you need another one as commissioner to whom you give the masterkey. I think that the NCP could be a commissioner itself then you would not need 3 but 2, but I never tried that as it's not easy to use the same as NCP and cli, it can break the web gui access to the ncp. It might sound weird why would anyone need a commissionner and not give the masterkey directly to the end device ? Reason is for product solds with a vendor commissioner who has the master key, then other devices sold separately do not have the masterkey. Also the assumption is that the devices are so small that they don't have any input keyboard or screen or wifi server also they're supposed to be closed so users are not supposed to mess with serial cli access, with everything closed only the commissioning process is what can transfer the secret. The Rasp and its NCP can definitely be a commissioner but I never tried then with Rasp CLI, but what should work is using the mobile app that discovers the Rasp border router on the network and use the smartphone app to allow a new device to join, there also I abandoned and never managed to get it to work, but if you follow the official tutorials and ask on corresponding forums, there's no reasons why it should not work. The I moved to a higher level app which is Matter and there I managed the commissioning too https://www.homesmartmesh.com/docs/frameworks/matter/#comissioning
Ok, then i will need
1) The NRF52 NCP on RASPBERRY Border Router - OK! Working 100% 2) Android as comissioner to a end device NRF52 - OK! 100% 3) NRF52 end device as a JOINER - OK! Working 100%
Starting mesh tests this week
hi, if the joiner power off and power up, need i do the comissioning again ? How can i do the second time JOIN automaticlly ?
I think you reached the level I have reached myself, the rest of the steps such as the android app comissionning, I never managed it through. But I'm sure it's only a matter of attempts and reading of official doc. I think that the Thread stack has its own non volatile memory management, I even had the issue that some configured parameters on newly flashed code were not taken in account because old ones from nvm were taking, so it's important to erase it manually. I also think that you will need to escalate the nRF52 debug options so that you can comfortably see what's going on inside the chip, for that you can check this page, Tracing with System viewer and step Debugging with Ozone who are a mandatory completion to the log and printf debugging https://www.homesmartmesh.com/docs/frameworks/zephyr/#trace-with-with-systemview An additional Observation point is the Thread sniffer on wireshark, it helped me a lot as sometimes devices boradcast on different channels or send unexpected messages that reveal their state, from a trhead device you can only see correctly interpreted messages, but from wireshark you can see all messages on the same radio channel.
@wassfila Wassin
Thanks for all your help! I mention you and end of blog!
I am mounting more two nina b302 to make a test using 3 nodes running!
You're welcome. You have lucky Students to whom you Teach something Fancy. I'd be glad to follow your progress.
https://github.com/nRFMesh/nRF52_Mesh/discussions/9
@tcpipchip most of the know how transfer is done, so I will close this ticket, and I'd be happy if you update me about your progress or if you have any question to discuss. If it's a bug related to the repo, a ticket here would be ok, for everything else, I activated the gihub discussions which is appropriate for such type of discussion we had so far : https://github.com/nRFMesh/nRF52_Mesh/discussions I moved away from the dedicated Discourse forum to the github Discussions here because it's easier for everyone who already have a github account.
Will run on raspberry zero w ? If not, can i use the raspberry virtual box image with ble ? I have here a lot of nrf52 modules