# First time dealing with Raspberry for a specific use.

#### atferrari

Joined Jan 6, 2004
4,594
Please note that the guy commanding this project is who decided it will be Raspberry something (model an peripherals) still unknown. Hence please no knee jerk Arduino/PIC (much I would kike it to be)/AVR suggestions.

I do not even know yet what OS would be installed.

Since I started to value more my free time, I do not intent to demolish all bricks of each wall but the necessary to go head on to results. Expert is not my game. I recognize spending the hell of time in reading full datasheets in the last two decades. Now I am trying to avoid that.

Going out of my comfort zone (PICs) is unusual.

My request, thinking I would be writing whatever is required to light lamps (on a small "curtain" in a balcony) (think of those used in Christmas time):

a) What would be the shortest path I should travel (IOW reading/ learning what?) to have comfortable access to the IO pins?

b) Should I need Python?

c) Could I end using Assembler?

Ah, just in case, I am not C conversant at all.

#### dl324

Joined Mar 30, 2015
14,467
The standard OS for Raspberry Pi is Raspbian, a Debian derivative.

What toggle speed to you require for the I/O's? Do you know any scripting languages (e.g. Perl or Python)?

I/O speed will be the lowest for something like CSH. Ranked in increasing speed: Perl/Python, C, Assembly. Unless you need higher speed than you can get from C, you don't need to bother with assembly. If you don't already know Python, I'd bite the bullet and learn C/C++.

#### atferrari

Joined Jan 6, 2004
4,594
The standard OS for Raspberry Pi is Raspbian, a Debian derivative.

What toggle speed to you require for the I/O's? Do you know any scripting languages (e.g. Perl or Python)?

I/O speed will be the lowest for something like CSH. Ranked in increasing speed: Perl/Python, C, Assembly. Unless you need higher speed than you can get from C, you don't need to bother with assembly. If you don't already know Python, I'd bite the bullet and learn C/C++.
Toggle speed: not sure. It is an animated display not even sketched yet.

Did a very brief attempt with Python. An old experience with C was quitting due to pointers.

#### GetDeviceInfo

Joined Jun 7, 2009
2,095
And I’d go with python, running C if at all required, from within. I would consider remote I/O with an appropriate comms driver. Will it be networking with a higher level system.

#### nsaspook

Joined Aug 27, 2009
9,733
The nice thing about the RPi is it's pretty vanilla Linux. Python will work just fine for for human response speed light control and there are tons of online examples for the RPi. What's the lighting interface? DMX, gpio to relays, NeoPixel LEDs, etc ... ?

#### Ya’akov

Joined Jan 27, 2019
5,663
I agree with the general consensus that you should use Python. It is the native language, so to speak, for the RPi when dealing with GPIO and the like. The learning curve for Python is not very steep though it is a bit more if you don't have experience with dynamic languages.

There is a Python module called RPi.GPIO with extensive documentation. The methods are simple. It will probably do what you want.

As a bonus, the RPi Pico microcontroller's preferred programming environment is CircuitPython. The Pico is cheap, it has very useful "PIO" which is Programmable IO. Basically tiny state machines the execute small programs written in a very simplified language akin to assembler. The PIO can handle the state of pins and do other things entirely separate from the processor and so free of contention and timing issues.

Since the RPi Pico is a Raspberry Pi perhaps you can use it as an acceptable "peripheral" which would make things easier if you need what the PIO can do.

#### atferrari

Joined Jan 6, 2004
4,594
The nice thing about the RPi is it's pretty vanilla Linux. Python will work just fine for for human response speed light control and there are tons of online examples for the RPi. What's the lighting interface? DMX, gpio to relays, NeoPixel LEDs, etc ... ?
Thinking of light bulbs I considered BJT-triggered triacs but seems a dated solution. (I am leaving this for another thread).

#### atferrari

Joined Jan 6, 2004
4,594
And I’d go with python, running C if at all required, from within. I would consider remote I/O with an appropriate comms driver. Will it be networking with a higher level system.
Sorry GDI but cannot get what you are trying to explain. Could you elaborate a little? Non native here.

#### GetDeviceInfo

Joined Jun 7, 2009
2,095
I just went with my minds eye, and as it may be a long way off your plan, I'd disregard it

#### atferrari

Joined Jan 6, 2004
4,594
I agree with the general consensus that you should use Python. It is the native language, so to speak, for the RPi when dealing with GPIO and the like. The learning curve for Python is not very steep though it is a bit more if you don't have experience with dynamic languages.

There is a Python module called RPi.GPIO with extensive documentation. The methods are simple. It will probably do what you want.

As a bonus, the RPi Pico microcontroller's preferred programming environment is CircuitPython. The Pico is cheap, it has very useful "PIO" which is Programmable IO. Basically tiny state machines the execute small programs written in a very simplified language akin to assembler. The PIO can handle the state of pins and do other things entirely separate from the processor and so free of contention and timing issues.

Since the RPi Pico is a Raspberry Pi perhaps you can use it as an acceptable "peripheral" which would make things easier if you need what the PIO can do.
Gracias Yaakov.

Starting to distinguish things... Let's talk to the "project manager"

#### ErnieM

Joined Apr 24, 2011
8,294
Last year I had a task at work to create a controller to run 10 units of "something covered by ITAR" that needed to be turned on and off 200 times in sync with an environmental chamber ("shake & bake" or combined vibration and thermal exposures). When turned on the current needed to be monitored.

Not a terribly involved task, until you bring in the traditional array of a PC and a ton of GPIB measurement and control instruments. $Or, as I did, mount a Pi with a nice touchscreen on top of a small custom PCB. The GPIO would drive some big MOSFETs to drive the power relays, a current sense chip on each power output, an analog mux to drive the current readings into a very cute 6 pin A2D read by the Pi over I2C. Call it around$400 for everything but the custom PCB (which was absurdly expensive to be ITAR compliant). Runs a program in Python that drives everything, has a nice GUI, and has not mislead any of the techs running it.

#### MrSalts

Joined Apr 2, 2020
1,762
The good news, you can use the raspberry pi just like your laptop. It runs a browser, you can connect to the internet and ACC.
Setup is pretty standard - especially if you buy a pre-formatted SD card.
The great news is you can run a BASH script (much like a DOS script but much more versatile).
Also, scripts (BASH or Python) don't have to be compiled, just executed.
That being said, you can ask anybody for help, they can send you a script or possibly posted on this forum and then (assuming you are viewing this forum from your raspberry pi) you can download it and save to your raspberry pi and run the script.

you may need to install some libraries for Python. It is unlikely you'll need any libraries or new code if you are going to run a BASH script.

Note that scripts are much, much easier to deal with than compiling c because scripts are literally no work at all.
We can talk you through running a script someone where writes for you. You can look at the script and, with your assembly know-how, you'll be editing them in no time at all. It becomes quite obvious with a little time.