#RaspberryPi – 1st setup no monitor 📺: Wifi 📶 auto connect, SSH, rename, update, docker 🐳 and more! Update 2021-Mar-22

Buy Me A Coffee

Hi!

Let’s start installing the latest Raspberry Pi OS image in an SD card. Next steps will be focus on how to access and control remotely your device you may want to follow this steps.

raspberry Pi Images install SO

This tutorial and tips works for Raspberry Pi 3, 4 and Zero.

Update 2021-Mar-22.

The version 1.6 of Raspberry Pi Imager includes a new feature that allows to

  • Define HostName
  • Enable SSH
  • Configure Wifi
  • Set locale

Directly from the tool. Just press [Ctrl-Shift-X] and define this settings on the tool screen.

I’ll leave the old-school standard methods below just as a reference.

Configure Wireless connection (old-school)

In the SD Card, you need to create a file named [wpa_supplicant.conf] in the root of the SD card with the following information:

country=ca
update_config=1
ctrl_interface=/var/run/wpa_supplicant

network={
 scan_ssid=1
 ssid=" Your WiFi SSID"
 psk="You amazing password"
}

The file content is very straight forward to understand. Main values to complete are [ssid] and [psk].

Once you put the SD card in the device and start the device, it will automatically connect to the configured WiFi.

Enable SSH (old-school)

If you also want to enable SSH, you need to create a blank file named [ssh] to the main partition.

Once you put the SD card in the device and start the device, it will automatically enable the SSH service.

So, you need to create and copy 2 files to the root of your SD card

  • wpa_supplicant.conf
  • ssh

Find the IP address in your network

And that’s it, your Raspberry Pi will be connected to the Wifi and with SSH enabled. At this moment we can use a tool like AngryIp (see references) to detect the new device in the network

My new device IP is: 192.168.1.246

I’m trying to avoid Java updates, and even install java, so lately I use a mobile app: Fing, and after a search the results are nicer.

Access via SSH

I used to like Putty to connect to my device, however during the past months I’ve been using Windows Terminal and Powershell. In order to access the device I need to execute the command

ssh user@deviceaddress

and my data is

  • user: pi
  • ip: 192.168.1.246
  • password: raspberry

You can now start working with your Raspberry Pi !

Important: the default password is raspberry, please follow next step!

Change Password

The default password for the device is “raspberry”, and as usual, it’s recommended to change it. In order to do this, in the ssh terminal, let’s access to the device configuration

sudo raspi-config

This will open the configuration for the device.

raspi config main menu

Option number 1 will allow us to change the password.

Rename the device

In the same section we can change the Host Name.

And define the new name for the Raspberry Pi device.

Expand FileSystem

Another important option in the configuration is to expand the SD disk.In the same configuration screen, select

  • 6. Advanced Options
  • Expand File System
raspi config advanced options

Now we need to reboot and after the reboot the file system should have been expanded to include all available space on your micro-SD card. Reboot with the command

sudo reboot

Update the device

There are 2 ways to update the device, using commands and using raspi-config.

  • In the Raspi Config main menu, the option 8 will launch the update commands.
  • If you prefer to manually type an update command, this one works for me
sudo -- sh -c 'apt-get update; apt-get upgrade -y; apt-get dist-upgrade -y; apt-get autoremove -y; apt-get autoclean -y'
updates complete

Install Docker

The information is available from the Official Docker Documentation

curl -fsSL https://get.docker.com -o get-docker.sh

sudo sh get-docker.sh

And then, a simple check for the docker version with the command

docker version

Conclusion

And that’s it, we have our device updated and running with the latest software versions and we didn’t use a monitor! I’ll update this post frequently to make it relevant with my personal best practices.

Happy coding!

Greetings

El Bruno


My posts on Raspberry Pi ⚡🐲⚡

Dev posts for Raspberry Pi
Tools and Apps for Raspberry Pi
Setup the device
Hardware

#Azure – Reading configuration values in Azure Functions

Buy Me A Coffee

Hi !

I was learning about Azure Vault and Azure Functions, and it’s been an interesting ride. This tweet summarizes this ride 😎😁😎

So while I a was using Functions, I realized that at the end, we are working with WebApps. So, we have access to standard App Configurations.

Note: I’ll call it standard, however this reveal how old I am, remembering Asp.Net apps and web.config files.

Moving On, in the Azure Portal, we can access the Function Configuration via Function // Settings // Configuration.

As the official documentation describes

In App Service, app settings are variables passed as environment variables to the application code.

So, it super easy to access this with a simple line of code. The next examples shows how to read an environment variable named “dbConnectionString” where I store a connection string.

var cnnString = Environment.GetEnvironmentVariable("dbConnectionString", EnvironmentVariableTarget.Process);

Super easy ! and it also have the checks for security:

App settings are always encrypted when stored (encrypted-at-rest).

My next step in my journey will be describe how to also do this with KeyVault. And share some insights on both scenarios.

References

Happy coding!

Greetings

El Bruno



¿Con ganas de ponerte al día?

En Lemoncode te ofrecemos formación online impartida por profesionales que se baten el cobre en consultoría:

#RaspberryPi – 1st setup no monitor 📺: Wifi 📶 auto connect, SSH, rename, update, docker 🐳 and more! Update 2021-Jan-29 (deprecated)

Buy Me A Coffee

Deprecated, new version available here

Hi!

Let’s start installing the latest Raspberry Pi OS image in an SD card. Next steps will be focus on how to access and control remotely your device you may want to follow this steps.

raspberry Pi Images install SO

This tutorial and tips works for Raspberry Pi 3, 4 and Zero.

Configure Wireless connection

In the SD Card, you need to create a file named [wpa_supplicant.conf] in the root of the SD card with the following information:

country=ca
update_config=1
ctrl_interface=/var/run/wpa_supplicant

network={
 scan_ssid=1
 ssid=" Your WiFi SSID"
 psk="You amazing password"
}

The file content is very straight forward to understand. Main values to complete are [ssid] and [psk].

Once you put the SD card in the device and start the device, it will automatically connect to the configured WiFi.

Enable SSH

If you also want to enable SSH, you need to create a blank file named [ssh] to the main partition.

Once you put the SD card in the device and start the device, it will automatically enable the SSH service.

So, you need to create and copy 2 files to the root of your SD card

  • wpa_supplicant.conf
  • ssh

Find the IP address in your network

And that’s it, your Raspberry Pi will be connected to the Wifi and with SSH enabled. At this moment we can use a tool like AngryIp (see references) to detect the new device in the network

My new device IP is: 192.168.1.246

I’m trying to avoid Java updates, and even install java, so lately I use a mobile app: Fing, and after a search the results are nicer.

Access via SSH

I used to like Putty to connect to my device, however during the past months I’ve been using Windows Terminal and Powershell. In order to access the device I need to execute the command

ssh user@deviceaddress

and my data is

  • user: pi
  • ip: 192.168.1.246
  • password: raspberry

You can now start working with your Raspberry Pi !

Important: the default password is raspberry, please follow next step!

Change Password

The default password for the device is “raspberry”, and as usual, it’s recommended to change it. In order to do this, in the ssh terminal, let’s access to the device configuration

sudo raspi-config

This will open the configuration for the device.

raspi config main menu

Option number 1 will allow us to change the password.

Rename the device

In the same section we can change the Host Name.

And define the new name for the Raspberry Pi device.

Expand FileSystem

Another important option in the configuration is to expand the SD disk.In the same configuration screen, select

  • 6. Advanced Options
  • Expand File System
raspi config advanced options

Now we need to reboot and after the reboot the file system should have been expanded to include all available space on your micro-SD card. Reboot with the command

sudo reboot

Update the device

There are 2 ways to update the device, using commands and using raspi-config.

  • In the Raspi Config main menu, the option 8 will launch the update commands.
  • If you prefer to manually type an update command, this one works for me
sudo -- sh -c 'apt-get update; apt-get upgrade -y; apt-get dist-upgrade -y; apt-get autoremove -y; apt-get autoclean -y'
updates complete

Install Docker

The information is available from the Official Docker Documentation

curl -fsSL https://get.docker.com -o get-docker.sh

sudo sh get-docker.sh

And then, a simple check for the docker version with the command

docker version

Conclusion

And that’s it, we have our device updated and running with the latest software versions and we didn’t use a monitor! I’ll update this post frequently to make it relevant with my personal best practices.

Happy coding!

Greetings

El Bruno


My posts on Raspberry Pi ⚡🐲⚡

Dev posts for Raspberry Pi
Tools and Apps for Raspberry Pi
Setup the device
Hardware

#RaspberryPi – 1st setup no monitor: Wifi auto connect, SSH, rename, update, docker and more! Update 2020-Dec-21 (deprecated)

Buy Me A Coffee

Deprecated, new version available here

Hi!

Let’s start installing the latest Raspberry Pi OS image in an SD card. Next steps will be focus on how to access and control remotely your device you may want to follow this steps.

raspberry Pi Images install SO

This tutorial and tips works for Raspberry Pi 3, 4 and Zero.

Configure Wireless connection

In the SD Card, you need to create a file named [wpa_supplicant.conf] in the root of the SD card with the following information:

country=ca
update_config=1
ctrl_interface=/var/run/wpa_supplicant

network={
 scan_ssid=1
 ssid=" Your WiFi SSID"
 psk="You amazing password"
}

The file content is very straight forward to understand. Main values to complete are [ssid] and [psk].

Once you put the SD card in the device and start the device, it will automatically connect to the configured WiFi.

Enable SSH

If you also want to enable SSH, you need to create a blank file named [ssh] to the main partition.

Once you put the SD card in the device and start the device, it will automatically enable the SSH service.

So, you need to create and copy 2 files to the root of your SD card

  • wpa_supplicant.conf
  • ssh

Find the IP address in your network

And that’s it, your Raspberry Pi will be connected to the Wifi and with SSH enabled. At this moment we can use a tool like AngryIp (see references) to detect the new device in the network

My new device IP is: 192.168.1.246

Access via SSH

I used to like Putty to connect to my device, however during the past months I’ve been using Windows Terminal and Powershell. In order to access the device I need to execute the command

ssh user@deviceaddress

and my data is

  • user: pi
  • ip: 192.168.1.246
  • password: raspberry

You can now start working with your Raspberry Pi !

Important: the default password is raspberry, please follow next step!

Change Password

The default password for the device is “raspberry”, and as usual, it’s recommended to change it. In order to do this, in the ssh terminal, let’s access to the device configuration

sudo raspi-config

This will open the configuration for the device.

raspi config main menu

Option number 1 will allow us to change the password.

Rename the device

In the same section we can change the Host Name.

And define the new name for the Raspberry Pi device.

Expand FileSystem

Another important option in the configuration is to expand the SD disk.In the same configuration screen, select

  • 6. Advanced Options
  • Expand File System
raspi config advanced options

Now we need to reboot and after the reboot the file system should have been expanded to include all available space on your micro-SD card. Reboot with the command

sudo reboot

Update the device

There are 2 ways to update the device, using commands and using raspi-config.

  • In the Raspi Config main menu, the option 8 will launch the update commands.
  • If you prefer to manually type an update command, this one works for me
sudo -- sh -c 'apt-get update; apt-get upgrade -y; apt-get dist-upgrade -y; apt-get autoremove -y; apt-get autoclean -y'
updates complete

Install Docker

The information is available from the Official Docker Documentation

curl -fsSL https://get.docker.com -o get-docker.sh

sudo sh get-docker.sh

And then, a simple check for the docker version with the command

docker version

Conclusion

And that’s it, we have our device updated and running with the latest software versions and we didn’t use a monitor! I’ll update this post frequently to make it relevant with my personal best practices.

Happy coding!

Greetings

El Bruno


My posts on Raspberry Pi ⚡🐲⚡

Dev posts for Raspberry Pi
Tools and Apps for Raspberry Pi
Setup the device
Hardware

#RaspberryPi – setup without monitor: enable VNC

Buy Me A Coffee

Hi!

In my previous post I shared a series of steps to:

  • Configure and SD Card with Raspbian
  • Automatically connect to a WiFi network
  • Enable SSH
  • Expand the file system
  • Rename the device
  • Update the default Raspbian software

In this post I’ll share the necessary steps to enable the VNC service, so you can connect to the Raspbian Desktop via VNC.

Enable VNC

In order to activate the VNC service we need to access to the device configuration with the command

sudo raspi-config

Then we select the options

  • Interfacing Options
  • VNC

Select YES

And that’s it, the VNC Server is enabled.

Now we can connect to the device with a VNC client app. Like in example, VNC Viewer

Conclusion

And that’s it, we have our device updated and running with the latest software versions and we didn’t use a monitor! I’ll update this post frequently to make it relevant with my personal best practices.

Happy coding!

Greetings

El Bruno


References

My posts on Raspberry Pi ⚡🐲⚡

Dev posts for Raspberry Pi
Tools and Apps for Raspberry Pi
Setup the device
Hardware

#RaspberryPi – 1st setup without monitor: auto connect to WiFi, enable SSH, rename, update and more! (deprecated)

Buy Me A Coffee

Deprecated, new version available here

Hi!

Ok, let’s assume you did the tutorial and installed the latest raspbian image in an SD card. If you want to access and control remotely your device you may want to follow this steps.

Configure Wireless connection

In the SD Card, you need to create a file named [wpa_supplicant.conf] in the root of the SD card with the following information:

country=ca
update_config=1
ctrl_interface=/var/run/wpa_supplicant

network={
 scan_ssid=1
 ssid=" Your WiFi SSID"
 psk="You amazing password"
}

The file content is very straight forward to understand. Main values to complete are [ssid] and [psk].

Once you put the SD card in the device and start the device, it will automatically connect to the configured WiFi.

Enable SSH

If you also want to enable SSH, you need to create a blank file named [ssh] to the main partition.

Once you put the SD card in the device and start the device, it will automatically enable the SSH service.

Find the IP address in your network

And that’s it, your Raspberry Pi will be connected to the Wifi and with SSH enabled. At this moment we can use a tool like AngryIp (see references) to detect the new device in the network

My new device IP is: 192.168.1.246

Access via SSH

I used to like Putty to connect to my device, however during the past months I’ve been using Windows Terminal and Powershell. In order to access the device I need to execute the command

ssh user@deviceaddress

and my data is

  • user: pi
  • ip: 192.168.1.246
  • password: raspberry

You can now start working with your Raspberry Pi !

Change Password

The default password for the device is “raspberry”, and as usual, it’s recommended to change it. In order to do this, in the ssh terminal, let’s access to the device configuration

sudo raspi-config

This will open the configuration for the device.

Option number 1 will allow us to change the password.

Rename the device

In the same Raspberry configuration tool, we can rename the hostname that our device will use for network operations.

Select the options

  • Network Options
  • Hostname

And define the new name for the Raspberry Pi device.

Expand FileSystem

Another important option in the configuration is to expand the SD disk.In the same configuration screen, select

  • 7. Advanced Options
  • Expand File System

Now we need to reboot and after the reboot the file system should have been expanded to include all available space on your micro-SD card. Reboot with the command

sudo reboot

Update the device

Of course, at this moment you should change your default password and update everything with a command like this one

sudo -- sh -c 'apt-get update; apt-get upgrade -y; apt-get dist-upgrade -y; apt-get autoremove -y; apt-get autoclean -y'

Conclusion

And that’s it, we have our device updated and running with the latest software versions and we didn’t use a monitor! I’ll update this post frequently to make it relevant with my personal best practices.

Happy coding!

Greetings

El Bruno


References

My posts on Raspberry Pi ⚡🐲⚡

Dev posts for Raspberry Pi
Tools and Apps for Raspberry Pi
Setup the device
Hardware

#Flow – Using configuration information from an App using #OneDrive, #Excel, Microsoft Flow and HTTP Requests

 

Hi!

It is no news that Developers and Business Users speak different languages. This is why, sometimes when I ask a business User to update a configuration file, it usually does not ends well. It happened to me when sharing [.json], [.config], or [.xml] files,
these users do not know which tool to use to edit the values, and also happens that a plain text format, is often not intuitive for them.

That’s why a while ago, I took a different approach: I decided to adapt myself to their tools and ways to work. In a nutshell the working model with these files is as follows

 

  • Business Users: Microsoft Excel
  • Developers: Json

And as we are in a time where [Serverless] is the premise, I challenged myself to see if I could do it without writing a single line of code. To do this, use Microsoft Flow as the base integrating information store in OneDrive with Excel files and interacting with the flow using HTTP requests.

The first thing was to create a spreadsheet with information to share, in this case a list of users, email accounts and twitter.

I1

The, I saved the file in OneDrive and I grant access to the file to my Business Users. They can happily edit the file now.

I2

And then I created a Flow to access to this configuration file but in a developer mode. The Flow is using an HTTP Request as the trigger, then it reads the information from the Excel file and it closes with an standard HTTP Response including the content of the Excel file in Json format.

I3

There is only one tricky step here, and is when we need to build the Json response. To do this, I use a simple Flow Expression working with the main body of the Excel file.

I4

When we save the Flow, we can access to the public URL where the flow is published. This is the URL we can use in our Apps to access to this information. To test this without a full .Net App, we can use Postman (I wrote about this some time ago). 1 Url copy and 2 clicks later, and we can see the HTTP response with the configuration information in Json..

I5

As soon as Flow uses this Excel file, we will see a new column in the excel file [__PowerAppsId__]. We should not  delete this column. The easy way to explain this is: Flow uses this column as base to check where / when a file was accessed and to see the changes on this.

However we can add more information to the file, and if we want, an extra column with new information, in example:

I6

As soon as the changes are reflected and stored in OneDrive, a new request to our Flow will return a new complete Json response with the new column and the new rows.

I7

As a ZERO CODE solution, this rocks! and it rocks twice if you also gives your users the chance to use Excel as a edition tool for this.

Happy Coding!

Greetings @ Toronto

El Bruno

References

Tools

My posts on Logic Apps

My posts on Flow

 

#Flow – Manejando información de configuración de Apps con #OneDrive, #Excel, Microsoft Flow y peticiones HTTP

 

Hola!

No es ninguna novedad que los developers y los usuarios de negocios hablamos lenguajes diferentes. Es por esto, que en algunas ocasiones pedir a un usuario de negocio que actualice un archivo de configuración puede no ser una buena idea. Me ha sucedido que al compartir archivos [.json], [.config] o [.xml], estos usuarios no saben que herramienta utilizar para editar los valores, y también sucede que un formato de texto plano, suele no ser intuitivo para ellos.

Es por eso que hace un tiempo, tomé un enfoque diferente: decidí adaptarme a sus herramientas. En pocas palabras el modelo de trabajo con estos archivos es el siguiente

  • Business Users: Microsoft Excel
  • Developers: Json

Y como estamos en una época donde [Serverless] es la premisa, me desafié a mí mismo, para ver si podía hacerlo sin tocar una línea de código. Para esto utilice como base Microsoft Flow integrando los servicios de OneDrive, Excel e interactuando con peticiones HTTP.

Lo primero fue crear una hoja de cálculo con información a compartir, en este caso un listado de usuarios, cuentas de email y twitter.

I1

Luego almacene el archivo de Excel en OneDrive y compartir acceso con el usuario de Negocio que la editara.

I2

El Flow para consultar la información, se dispara con una petición HTTP Request, luego se lee la información de Excel desde OneDrive y se retorna la misma en una HTTP Response.

I3

El único paso donde se requiere una configuración especial es en la creación del Response, ya que utilizo una Expression del tipo String para crear el response con la información completa de las filas de Excel.

I4

Pues bien, al guardar el Flow, el mismo crea la Url donde podemos invocar al mismo. Como explique en un post anterior, podemos utilizar Postman para probar este tipo de Flows, en este caso un simple HTTP POST Request y ya tenemos nuestra información en formato Json.

I5

A partir de ahora, en nuestra hoja Excel ahora veremos una nueva columna llamada [__PowerAppsId__] que es la que utiliza Flow para tener un Track de los accesos y el trabajo con esta hoja de cálculo. Es importante explicar a nuestros usuarios que esta columna no debe ser modificada. Si por ejemplo agregamos una nueva columna y más información al archivo Excel podremos ver algo similar a la siguiente imagen.

I6

Si realizamos una nueva petición, podremos ver que el Response incluye los nuevos campos y los nuevos registros.

I7

Pues bien, como solución ZERO CODE para compartir y editar información de con usuarios de negocios, me parece que esto es suficiente.

Happy Coding!

Saludos @ Toronto

El Bruno

References

Tools

My posts on Logic Apps

My posts on Flow

 

#Hololens – Now you can work with Visual Studio tools for #Unity3D and #VS2017

Hello!

Every couple of months, I’ve had to reinstall my development environment from scratch. This time was not a software problem, this one was raised by hardware issue: my 2nd disc died (and I lost some of my not backup / sync information). As if it were a coincidence, I’ve taken advantage of an offer of Black Friday, Pink Saturday or something like that, and I have bought a 2 TB disk quite interesting (link). This leaves me with a

So let’s put a smile and see the bright side on this. I take advantage of an offer during Black Friday, Pink Saturday or something like that. I have bought a 2 TB 2.5” internal disk with some very amazing features. So now I have a happy  development environment again:

  • 500GB SSD main drive
  • 2 TB as secondary drive

clipboard01

Now, because I started from zero (again) I decided to try to work purely and exclusively with Visual Studio 2017 RC. One of the first things I’ve noticed is Visual Studio Tools for Unity3D were available only for Visual Studio 2015. This meant a serious impediment, VSTU are part of the development of Hololens VS + Unity.

Fortunately, the latest version published today in Visual Studio Tools for Unity, supports Visual Studio 2017 in Beta (3.0) mode.

clipboard03

It won’t work smooth from scratch, you need to perform some additional steps so everything works fine, for example:

  • In Unity, access the menu “Edit / Preferences”
  • Select [External Tools / External Script Editor]
  • In the combo choices we see MonoDevelop, Visual Studio 2015 and Browse.
  • Select Browse and select the path of the executable for Visual Studio 2017 [“%\Program Files\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\devenv.exe”]

At this time we will see VS2017 RC as the selected option and we can start to work with this IDE

clipboard05

Here we see the instance of Visual Studio 2017, in mode debugging from which we can attacharnos at one instance of Unity and debug against the same.

clipboard07

Now if we can forget about Visual Studio 2015 and follow created apps with Unity3D and Visual Studio 2107 Hololens RC!

Greetings @ Toronto

El Bruno

References