Tips & Tricks for Raspberry PI
Tips & Tricks for Raspberry PI
Tips and Tricks for Raspberry PI
Purebasic IDE
- Purebasic-IDE runas sudo from desktop icon (mk-soft)
- Add PureBasic IDE to Start Menu Development from LXpanel (mk-soft)
System Info
- CPU Temperatur (mk-soft)
- Get Machine ID (Rings)
- Get Linux Version (Rings)
IO System
- Port Audio Example (idle)
Purebasic IDE
- Purebasic-IDE runas sudo from desktop icon (mk-soft)
- Add PureBasic IDE to Start Menu Development from LXpanel (mk-soft)
System Info
- CPU Temperatur (mk-soft)
- Get Machine ID (Rings)
- Get Linux Version (Rings)
IO System
- Port Audio Example (idle)
Last edited by mk-soft on Sun Mar 06, 2022 2:53 pm, edited 4 times in total.
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
Re: Tips & Tricks for Raspberry PI
CPU Temperatur
Code: Select all
;-TOP by mk-soft, v1.01.1, 18.12.2021
#fileTemp = "/sys/class/thermal/thermal_zone0/temp"
Procedure.f get_cpu_temp()
Protected r1.f, file, temp.s
file = ReadFile(#PB_Any, #fileTemp)
If file
temp = ReadString(file, #PB_UTF8)
CloseFile(file)
r1 = 0.001 * Val(temp)
Else
r1 = 99.0
EndIf
ProcedureReturn r1
EndProcedure
For i = 1 To 5
Debug get_cpu_temp()
Delay(1000)
Next
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
Re: Tips & Tricks for Raspberry PI
Great my pi is running at 58c
Re: Tips & Tricks for Raspberry PI
58c, isn't it a bit high?
do you have a heat-sink/fan installed?
do you have a heat-sink/fan installed?
Re: Tips & Tricks for Raspberry PI
No,
I have a fan and it only switches the regulation on at 60°C and off at 50°C.
Small App CPU Temperature on Systray
I have a fan and it only switches the regulation on at 60°C and off at 50°C.
Small App CPU Temperature on Systray
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
Re: Tips & Tricks for Raspberry PI
<OT>
The average temperature of my RasPi running HomeAssistant is 40°C.
</OT>
The average temperature of my RasPi running HomeAssistant is 40°C.
</OT>
Hygge
Re: Tips & Tricks for Raspberry PI
My Pi (Model 2B V1.1) running as NAS so in console mode, no enclosure, no fan: temperature 38° c
(Electronics do not wear out, but they age faster when they are too hot. Prefer large (metal) cases with lots of (passive) ventilation(s))
For console mode of mk-soft' version: I have changed line 20 (Debug) to: PrintN(Str(get_cpu_temp()))
(Electronics do not wear out, but they age faster when they are too hot. Prefer large (metal) cases with lots of (passive) ventilation(s))
For console mode of mk-soft' version: I have changed line 20 (Debug) to: PrintN(Str(get_cpu_temp()))
Re: Tips & Tricks for Raspberry PI
@Jack Yes probably is a bit high there's no heat sink and it's an a plastic box.
Re: Tips & Tricks for Raspberry PI
My PI3 with a HIFI-Berry board and a MIDI interface connected runs at 54°C, only VNC server (always) active.
Temperature wend to 80°C (red icon) when i ran a full screen movie in VLC and did, at the same time, a download at 1MB/sec.
This never gave any problems and only now I can see the temperature.
No heatsink and all in a plastic box.
Temperature wend to 80°C (red icon) when i ran a full screen movie in VLC and did, at the same time, a download at 1MB/sec.
This never gave any problems and only now I can see the temperature.
No heatsink and all in a plastic box.
Yeah I know, but keep in mind ... Leonardo da Vinci was also an autodidact.
Re: Tips & Tricks for Raspberry PI
I am still a beginner, but you can run the Raspberry without a heat sink. The PI 4 says that the Tackt frequency is taken down and 90 ° C is still no problem.
Have only the Systray the Tempertur limit for red set to 80 ° C.
At Joy-IT I have seen a mini heat sink set (3 pieces). Could fit even without a fan.
Have only the Systray the Tempertur limit for red set to 80 ° C.
At Joy-IT I have seen a mini heat sink set (3 pieces). Could fit even without a fan.
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
Re: Tips & Tricks for Raspberry PI
Purebasic-IDE runas sudo
Some needs root right for hardware access. Her now a desktop file to start direct as sudo
Save as PB_Sudo.desktop in folder Desktop
Some needs root right for hardware access. Her now a desktop file to start direct as sudo
Save as PB_Sudo.desktop in folder Desktop
[Desktop Entry]
Type=Application
Icon=/home/pi/Apps/purebasic/logo.png
Name=PB v6.00 (sudo)
Comment=Developer Utility
Exec=sudo /home/pi/Apps/purebasic/compilers/purebasic
Path=/home/pi/Apps/purebasic/compilers
StartupNotify=false
Terminal=false
Name[de_DE]=PB v6.0 (sudo)
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
get a unique id from the raspberry,
Code: Select all
;get a unique id from the raspberry,
;S.Rings 2021-12-28
Procedure.s get_machine_id()
Protected file, temp.s
file = ReadFile(#PB_Any, "/etc/machine-id")
If file
temp = ReadString(file, #PB_UTF8)
CloseFile(file)
Else
EndIf
ProcedureReturn temp
EndProcedure
Debug get_machine_id()
SPAMINATOR NR.1
get linux version from the raspberry
Code: Select all
;get linux version from the raspberry,
;S.Rings 2021-12-28
Procedure.s get_linuxversion()
Protected file, temp.s
file = ReadFile(#PB_Any, "/etc/os-release")
If file
temp = ReadString(file, #PB_UTF8)
CloseFile(file)
Else
EndIf
If Len(temp)>0
temp=Mid(temp,14,Len(temp)-14)
EndIf
ProcedureReturn temp
EndProcedure
Debug get_linuxversion()
SPAMINATOR NR.1
Re: Tips & Tricks for Raspberry PI
PortAudio example (mixing c with PB)
Code: Select all
;sudo apt-get install portaudio19-dev
ImportC "-lportaudio" : EndImport
!#include "/usr/include/portaudio.h"
Structure paTestData
left_phase.f;
right_phase.f;
EndStructure
Global *stream;
Global err
Global num_seconds= 4;
Global sample_rate = 44100;
Global *output
Global mData.PaTestData
;** This routine will be called by the PortAudio engine when audio is needed.
;** It may called at interrupt level on some machines so don't do anything
;** that could mess up the system like calling malloc() Or free().
Procedure patestCallback(*inputBuffer,*outputBuffer,framesPerBuffer,*timeInfo,statusFlags,*userData.paTestData)
*out.float = *outputBuffer;
Protected i
For i=0 To framesPerBuffer
*out\f = *userData\left_phase; /* left */
*out+4
*out\f = *userData\right_phase; /* right */
*out+4
;/* Generate simple sawtooth phaser that ranges between -1.0 And 1.0. */
*userData\left_phase + 0.01
;/* When signal reaches top, drop back down. */
If *userData\left_phase >= 1.0
*userData\left_phase - 1.0
EndIf
;higher pitch so we can distinguish left And right. */
*userData\right_phase + 0.03
If *userData\right_phase >= 1.0
*userData\right_phase = -1.0;
EndIf
Next
EndProcedure ;
Global paCallback = @patestCallback()
Debug "PortAudio Test: output sawtooth wave."
!v_err = Pa_Initialize();
If err <> 0
Goto error;
EndIf
!v_err = Pa_OpenDefaultStream(&p_stream,0,2,paFloat32,v_sample_rate,16,v_pacallback,&v_mdata);
If err <> 0
Goto error;
EndIf
!v_err = Pa_StartStream(p_stream);
If err <> 0
Goto error;
EndIf
!Pa_Sleep(v_num_seconds*1000);
!v_err = Pa_StopStream(p_stream );
If err <> 0
Goto error;
EndIf
!v_err = Pa_CloseStream(p_stream);
If err <> paNoError
Goto error;
EndIf
!Pa_Terminate();
Debug "Test finished"
End
error:
!Pa_Terminate();
Debug "An error occured while using the portaudio stream"
Debug "error number " + Str(err)
!p_output = Pa_GetErrorText(v_err);
Debug PeekS(*out,-1,#PB_UTF8)