- Level - Beginner / Intermediate 43%
- Duration - 30-60 min 43%
- Costs - € 135,03 exc. LED and push button 50%
Step 1: supplies
Product: | Quantity: | Price: | |
1 | Arduino Uno | 1 | €23,95 |
2 | Breadboard | 1 | €9,95 |
3 | Jumper Wire M / F | 2 | €4,45 |
4 | Jumper Wire M / M | 3 | €4,45 |
5 | LED | 1 | |
6 | Push button | 1 | |
7 | USB A to USB B cable | 1 | €2,99 |
8 | Raspberry Pi 4B | 1 | €59,89 |
9 | Raspberry Pi 4B Power Supply | 1 | €9,95 |
10 | Micro HDMI to HDMI cable | 1 | €9,45 |
11 | Raspberry Pi 4B housing | 1 | €9,95 |
Total | €135,03 |
Step 2: Wire Arduino & Raspberry Pi
First we will connect everything. The diagram below shows a Fritzing diagram. If you connect the components as follows, you can go to the next step.
Step 3: programming the Arduino
We program the Arduino in the Arduino IDE. The code you will use for this is below. If you want to learn it better, type the code instead of copying and pasting it. You will learn to program better.
Once you have written the code you can upload it to the Arduino. If successful, connect your Arduino to the Raspberry Pi.
Step 4: the Raspberry Pi computer programming
Now that you have programmed the Arduino you can connect it to the Raspberry Pi. Then you start up Node-RED. You will now see a console with a link that will look something like this: “http://xxx.xxx.xxx.xxx:1880”. The “xxx.xxx.xxx.xxx” is different for everyone. For us it is “10.122.0.139”. Go to the web browser on you Raspberry Pi or on another PC and go to this link. You will now see the following screen.
On the left you see a row of blocks that you can add. Go to the heading “Network” and drag a “serial in” to the white area. Then go to the heading “Raspberry Pi” and drag an “rpi gpio out” to the white area. Now connect these blocks with each other and now it is time to set the blocks. Double click on the “serial in” block. Select the correct port and give the block a name. Then double click on the block “rpi gpio out” and select “GPIO17 – 11”, then select “Digital output” at type. Then check “Initialize pin state?” on, select “initial level of pin – low (0)” and give the block a name.
Now click on Deploy at the top right and test your circuit. If it doesn't work, select a different port at “serial in”.