CTM Projects

June 23, 2021


Raspberry Pi, Model-4B

.  .  .

Raspberry Pi 4B Setup  &  Installing Arduino IDE

[ Click on any image below to see an enlarged clear view ]

Arduino IDE (Integrated Development Environment)

This post is to help me remember how I setup my Raspberry Pi 4 Model-B.

The information documented may also help others to setup their Raspberry Pi4B for the first time; however, the items and links I chose to document are really just a reminder for me to review when needed.

Raspberry Pi Model 4B Features

In this post … RasPi4B … Pi … Pi-4B … are all the Raspberry Pi – Model 4B

The reason I am using a Raspberry Pi 4B is I wish to be able to connect Arduino microcontrollers to the Pi-4B and download Arduino IDE sketches to the Arduino Mego 2560 R3 (MegaR3) and Arduino UNO R3 (UnoR3).

Arduino Mega 2560 R3 Microcontroller

In the future I wish to connect ESP32 & ESP8266 modules but there is an issue as of Nov. 2019 with the Raspbian version of the Arduino IDE that makes it more difficult to setup ESP32 & ESP8266 connections than the Windows Version of the Arduino IDE.
( I will discuss the ESP32 & ESP8266 issue later in this post )

Raspberry Pi ( sudo apt install ) arduino IDE issue

The 2 YouTube videos listed below will give ALL the information needed to setup a Raspberry Pi 4B, and I added additional helpful Links.
( I would suggest watching both videos before doing anything )

Getting Started With The Raspberry Pi 4 by ETA PRIME
YouTube:  https://youtu.be/8grooZWbH9Y
Video Summary:  Explains in detail everything you will need to know … Shows where to find links for installing Raspbian  … Shows how to Flash an image of Raspberry Pi’s Raspbian OS onto a MicroSD card … Pi Desktop Setup …

Arduino for Beginners: Installing the IDE by eleneasy
( Raspberry Pi Arduino IDE installation starts at 2:09 )
YouTube: https://youtu.be/hsBYu8HemXM?t=129
Video Summary: At 2:09 shows how to use just one line in the Raspberry Pi Desktop terminal ‘sudo apt install arduino‘ to install the Arduino IDE for use in Raspberry Pi’s Raspbian Operating System.

For the Latest Raspberry Pi Information →  https://www.raspberrypi.org/

RaspberryPi.org Website

Raspberry Pi 4B Setup is surprising easy once you watch this video …

Getting Started with the Pi 4

RASPBIAN is the Operating System for Raspberry Pi 4B

Raspbian Operating System

NOOBS is the installer for Raspbian Operating System

NOOBS Raspbian installer

Raspbian vs NOOBS Installer Option

If you wish, you can skip using the NOOBS installer and instead Flash Raspbian directly onto your SD Card.
( This is what I did by following directions in Tutorial Video 3:47 )

Raspbian Download ZIP Option

Another method to setup Raspberry Pi is to order a pre-loaded 32Gb Micro SD card with NOOBS; however, I chose to buy a larger 128Gb MicroSD card and FLASH an image of Raspbian onto the Micro SD Card.
https://www.canakit.com/raspberry-pi-sd-card-noobs.html

Raspberry Pi Pre-Installed NOOBS MicroSD Card

To Setup my Raspberry Pi 4B I used the following items :
( Used a Wireless Mouse & Wireless Keyboard for fewer cords )

( LINKS ARE THE EXACT ITEMS I USED )

1 – Raspberry Pi 4 Model-B (Link)

1 – 128Gb MicroSD Card (Link)

1 – USB C Power Cord by CanaKit (Link)
( Some brands don’t work correctly )

1 – CanaKit Pi 4 PiSwitch (USB-C) (Link)

1 – Mouse with Cord or Wireless (Link)

1 – Keyboard with Cord or Wireless (Link)

1 – HDMI Cable (Link) to Connect to TV or Monitor
( HDMI cable with micro-HDMI on one end and HDMI on other end )

1 – TV or Monitor that has unused HDMI input for HDMI cable
( Tested all HDMI TVs in house and they are Connected )

Also need access to a Windows, Mac, or Linux Computer to Flash Raspbian onto the MicroSD Card using a program called balenaEtcher.
( I used a Windows 7 computer to make sure it works with older systems )

STEP ONE – Download Raspbian

Raspbian Download Link: https://www.raspberrypi.org/downloads/raspbian/

I clicked on the Download ZIP option for Raspbian to follow along with the Video Tutorial and the ZIP file automatically downloaded into my Windows Downloads folder.
( Doesn’t matter where it is located, just know where to find it for 4th Step )

I did NOT unzip the downloaded ZIP file; instead, just left it in the Downloads folder untouched and moved onto the 2nd Step.
( balenaEtcher will unZip and Configure the Files onto the MicroSD card )

STEP TWO – Download/Install balenaEtcher

balenaEtcher Download Link: http://www.balena.io/etcher/

Download balenaEtcher to Flash MicroSD Card

I chose to download the balenaEtcher to my Windows ‘Downloads’ folder, and then clicked on it and went through the installation just as it is shown in ETA PRIME’s YouTube Video at 4:18

The Windows version of balenaEtcher is ‘Portable’ so it opens from whatever folder you have it in.

I followed the install directions and found nothing unusual about the installation, other than since it is portable I had to go to the Windows folder the icon was located in and click on it to start the program.

STEP THREE –  Put MicroSD card in the Windows computer SD slot

Make sure you know what drive letter the MicroSD is in on your computer.

When I purchase the 128Gb MicroSD card it came with a SD card size holder that the MicroSD card fit into and I put the SD Card holder with MicroSD in it into the computer’s SD card slot.
( My MicroSD Card showed as Drive F: but each computer may be different )

STEP FOUR – Flash (Raspbian ZIP) Image to MicroSD Card

After installing and opening balenaEtcher there are 3 button options … I clicked on ‘Select Image’ and chose the raspbian-buster-full ZIP file.

Flash Raspbian onto MicroSD with balenaEtcher

Next I clicked on the balenaEtcher option button ‘Select Drive‘ and chose the Windows computer drive letter that had the MicroSD card on it.
( My computer had MicroSD Card in F: but yours may be different )

When I chose F: to Flash the raspbian-buster-full  ZIP file onto, the balenaEtcher program gave me a warning that the MicroSD seems very large and was a sure I wanted to Flash onto it? – Thus destroying whatever files were currently on the MicroSD card?

I assume with a 128Gb MicroSD card the balenaEtcher program was worried something that was 128Gb might be a backup drive, or hard-drive, so it just wanted me to double-check.  I knew I had chosen the correct letter drive for the MicroSD card so moved onto the final button option called Flash!.

Clicked on Flash! and it flashed the raspbian-buster-full  ZIP file just as shown in the Tutorial Video. (4:50)

I didn’t get any more warnings after it was done Flashing, so I closed balenaEtcher and then pulled my 128Gb MicroSD out of my Windows computer.

From this point Windows is no longer needed for Raspberry Pi 4B Setup.

STEP FIVE – Put MicroSD Card in Raspberry Pi 4B MicroSD Slot

I removed the MicroSD card from larger SD holder and put the Flashed 128Gb MicroSD card into MicroSD Slot located on Raspberry Pi 4B underside.

The Raspberry Pi 4B is now ready to have Keyboard, Mouse, and HDMI cords connected to it.

STEP SIX – Connect all the Cords with USB-C Power Last

Raspberry Pi Model 4B Features

Since I was using a wireless Mouse and Keyboard, I pushed the little USB wireless dongle connections into the Raspberry Pi’s USB-2 slots.
( Also shown in Tutorial Video at 6.11 )

I was told it didn’t matter which USB ports to connect the Keyboard and Mouse (USB-2 or USB-3) … and they seem to work in any of the USB ports … so I chose to put them in USB-2 to leave USB-3s open for other items.

Of course if you have Keyboard with a cord and/or mouse with a cord, then those would plug into the USB-2 or USB-3 ports.

HDMI Port on TV

Next I figured out which HDMI port I was connecting into on the TV and put in the large HDMI end of the cable into the TV and then used my TV Remote to choose the input that match the HDMI port opening on TV.

HDMI Cable with Micro HDMI on One End

The Cable box cord was plugged into HDMI Input 2 … so I chose to use HDMI port Input 1 to plug in the cord from the Raspberry Pi 4B and used the TV Remote to make sure I was viewing Input 1 on the screen.

After setting Input 1 with TV Remote the TV Screen said it had no signal, which was expected because I had not connected the USB-C Power Cord to start the Raspberry Pi 4B yet.

The small Micro HDMI end of the HDMI cord can be plugged into either one of the Micro HDMI ports located on the Raspberry Pi 4B.

USB-C Power Supply Cord

The last cord I plugged into the Raspberry Pi 4B was the USB-C Power Cord.  I purchased my USB-C power cord from CanaKit because I read their cords always work with the Pi, but some generic USB-C cords do not work correctly.

There seems to be some issues with some USB-C power plugs/cords, so if you don’t want to have any issues use the Official Raspberry Pi USB-C power cord or the CanaKit Raspberry Pi 4 Power Supply (USB-C) ( Link )

When I plugged in the USB-C Power Supply Cord into the Raspberry Pi 4B a little Red LED behind the USB-C port came on followed by a Green LED that Flashed.  I don’t remember now if the Red LED flashed first before turning solid Red but the Flashing of the Green LED next to the Red LED seems to be the indication that the Pi is reading the MicroSD Card.
( Hence, if you see a green LED flashing good stuff is happening )

On the first boot-up connected to my TV it took about 30 seconds maybe a minute ( It is hard to remember ) and then I saw a quick color blurry image on the TV Screen and then next a very clear image of 4 Raspberries on the top of the TV Screen … and then about 30 more seconds the Desktop image for Raspbian came into View on the TV.

If you only see the RED Led and never a Green Flashing LED then test plugging the HDMI Cable in a different Monitor or TV because I have a small 7″ Monitor that will not work on start up with my Raspberry Pi … but if I start the Pi with it plugged into my TV it works … and then after the Raspbian Desktop is showing on the TV screen … then… I can pull out the HDMI plug from the TV and plug it into the 7″ monitor and it works. ??
( I’ll figure out that 7″ monitor startup issue another day )

STEP SEVEN –  Follow Raspbian Desktop Setup

ETA PRIME’s YouTube Video walks through setting up Raspbian Desktop at ( 6:50 ) … Mostly making sure you set your correct language and also set the language to match your Keyboard, etc.

Set location close to a city you live so your time zone matches.

Setup asked if there was black space around edge of TV Screen (and there was) so I clicked on the option to indicate I had the black space and nothing happened at that time but later after reboot it filled the complete screen.

Once Raspbian Desktop setup is done it will reboot the Raspberry Pi 4B and you will be back looking at the Raspbian Desktop again.

Raspbian Appearance Settings to Make Menu Items Larger

I did have to change something AFTER the reboot AFTER setup was complete that was not shown in the Tutorial video.

Need to adjust the size of everything so I could see items larger on the Menu.  The lettering was much too small and very hard to see, so I clicked on the Side Desktop Menu under Preferences/Appearance Settings then chose the tab option called ‘Defaults’ … then chose the option that said ‘For Large Screens’ and everything was then much larger and easy to see on the 4K TV.

 

STEP EIGHT – Shutting Down the Raspberry Pi 4B

To turn off the Raspberry Pi 4B just unplug the USB-C Power Supply cord and the unit is off.

To make it easier to turn the Raspberry Pi on and off with out having to Plug-In and UnPlug, I purchase the CanaKit Raspberry Pi 4 USB-C  On/Off Switch.

CanaKit Raspberry Pi 4 USB-C On/Off Switch

When wish to START the Rasbberry Pi 4B again … just plug in the USB-C Power Supply cord and it only takes about 20 seconds to boot up to the Raspbian Desktop ready to use … or use the CanaKit Switch.

YES READY TO USE IN 20 Seconds!! … WHOO HOO!!!

Just 20 seconds and it is done opening and ready to use … and as a long time Windows user this was a cathartic moment because my Windows 7 computer (which I love) takes about 10 minutes to be completely ready to start using properly with SolidWorks.

 

ESP32 & ESP8266 Arduino IDE – ‘Additional Boards Manager URLs’

Arduino for Beginners: Installing the IDE by eleneasy
( Raspberry Pi Arduino IDE installation starts at 2:09 )
YouTube: https://youtu.be/hsBYu8HemXM?t=129
Video Summary: At 2:09 shows how to use just one line in the Raspberry Pi Desktop terminal ‘sudo apt install arduino‘ to install the Arduino IDE for use in Raspberry Pi’s Raspbian Operating System.

If you use the simple/quick method of opening a terminal window and typing sudo apt install arduino to install the Arduino IDE on your Raspberry Pi 4B you will find it is very fast and works great; however, the version it downloads as of November 2019 is not the same as the Windows version that I downloaded and installed the same day.

Raspberry Pi ( sudo apt install ) arduino IDE issue

If you are just going using boards sold by Arduino such as the UNO or MEGA, then no worries, but if you wish to use ESP32 or ESP8266 then you will notice a difference on the Raspberry Pi Arduino IDE version vs the Windows Arduino IDE version.  The ‘Additional Boards Manager URLs’ option is missing.

Arduino Windows Version Board Manager

If one looks in File/Preferences on the Windows version of the Arduino IDE there is a wonderful very easy to use option to add ESP32 & ESP8266 to the Arduino Boards Manager.

Just simply copy and paste in the ‘Additional Boards Manager URLs’ separated by a comma.  Install … Then go to Boards Manager under Tools/Board/ESP32 Arduino and scroll down until you see choices for ESP32 & ESP8266.
( I will update if find a good Tutorial Video for adding additional boards )

UPDATE: 2019-11-28 

How to Check for Arduino IDE Updates

Unfortunately, as of Nov. 2019 there is not an ‘Additional Boards Manager URLs’ option in preferences in the Arduino IDE version that loads onto Raspberry Pi, so you will have to research and find a different method of installing ESP32 & ESP8266 into the boards manager.

I’m not going to figure it out now in hopes they will update it soon, because I can just use my windows computer to download Arduino Sketches to ESP32 & ESP8266 boards.

One option might be to use Arduino Create and the Online Arduino IDE but they will charge you about $6 to $7 US dollars per month to have access to ESP32 & ESP8266 on the boards manager.

Arduino Create – Online IDE

The Arduino Boards are free but other boards you have to upgrade to get.

I personally thought $6.99 a month was a good deal, so I signed up for Arduino Create and upgraded for all the interesting items they offer … and I can sign onto any computer I wish and work on my sketches and even be able to Save and Verify sketch code.   Of course, I have to connect to a ESP or Arduino board if I wish to download the sketches.

As I write this in November of 2019 there are lots of great lessons and examples on Arduino Create.

Arduino Create Online Editor

I will update this post if someone lets me know of a ‘simple’ fix for the Raspberry Pi Version of the Arduino IDE and/or hear that it has been updated to match the Windows version with the ‘Additional Boards Manager URLs’ option in the preferences area.

Instructables.com is also a great place to find ideas …

Once again, this post was created for me to help remember things.

It is not so much a tutorial as a place to provide links to tutorials created by others … and interesting items/projects I find online about Arduino and Raspberry Pi.

…                         CHEERS!!

ADDITIONAL ITEMS to review :

Blynk App platform IoT Connection for Arduino Micro-Controllers

Elektor ESP32 Smart Kit Bundle with Arduino and MicroPython

Source