# Raspberry Pi Cam Module 3

**URL:** <https://forums.balena.io/t/raspberry-pi-cam-module-3/370294>\
**Category:** Project help\
**Tags:** raspberrypizero, picamera\
**Created:** [April 11, 2024, 3:35pm UTC](https://forums.balena.io/t/raspberry-pi-cam-module-3/370294 "2024-04-11T15:35:26Z")\
**Posts on this page:** 9\
**Page:** 3

<div class="post-metadata">

**Author:** ![TJvV](https://avatars.discourse-cdn.com/v4/letter/t/858c86/32.png) [@TJvV](https://forums.balena.io/u/TJvV)\
**Post date:** [May 26, 2024, 12:45pm UTC](https://forums.balena.io/t/raspberry-pi-cam-module-3/370294/44 "2024-05-26T12:45:19Z")

</div>

Hi,

I think your problem is that you specified the port ` - "9090"` for your camera.  
The ports format is `[<host>:]<container>`; because you did not specify a host port, one will be assigned at random.  
The easiest fix is to specify the host port yourself, like you did for the webserver.

---

<div class="post-metadata">

**Author:** ![Jake1](https://avatars.discourse-cdn.com/v4/letter/j/73ab20/32.png) [@Jake1](https://forums.balena.io/u/Jake1)\
**Post date:** [May 26, 2024, 12:58pm UTC](https://forums.balena.io/t/raspberry-pi-cam-module-3/370294/45 "2024-05-26T12:58:43Z")

</div>

In the docker compose do I change the port 9090 To 90:90 ?

---

<div class="post-metadata">

**Author:** ![TJvV](https://avatars.discourse-cdn.com/v4/letter/t/858c86/32.png) [@TJvV](https://forums.balena.io/u/TJvV)\
**Post date:** [May 26, 2024, 7:32pm UTC](https://forums.balena.io/t/raspberry-pi-cam-module-3/370294/46 "2024-05-26T19:32:31Z")

</div>

You can change it to whatever you want really.

If you want to connect to port 9090, change the entry to `9090:9090`.  
If you want to connect to port 12345, change the entry to `12345:9090`.

Note that these are host ports that change; the container port should remain the same.  
They are used when you want to connect to the device.

From one container, you can connect to the other container using its service name, without having to expose the port in such a way.  
So, within your `webserver`, you can connect to the `camera` using `http://camera:9090` (or whatever protocol it is actually running).

---

<div class="post-metadata">

**Author:** ![Jake1](https://avatars.discourse-cdn.com/v4/letter/j/73ab20/32.png) [@Jake1](https://forums.balena.io/u/Jake1)\
**Post date:** [May 27, 2024, 9:01pm UTC](https://forums.balena.io/t/raspberry-pi-cam-module-3/370294/47 "2024-05-27T21:01:34Z")

</div>

I’ve changed the docker compose camera port to `"90:90"` and the docker.template & bash file to expose port 90. However when i go to the `http://ip:9090/stream` it would attempt to load however show the same message took too long to respond.

I’ve updated the github files to the latest code I’ve been attempting to upload. I have also tried changing the balena compose to `"9090:9090"` however this would show the message saying `... refused to connect`. I also attempted to change the expose to 9090 but didn’t make any difference ☹

Thank you for the continued support. Hopefully almost their now 🤞

---

<div class="post-metadata">

**Author:** ![Jake1](https://avatars.discourse-cdn.com/v4/letter/j/73ab20/32.png) [@Jake1](https://forums.balena.io/u/Jake1)\
**Post date:** [June 4, 2024, 9:53pm UTC](https://forums.balena.io/t/raspberry-pi-cam-module-3/370294/48 "2024-06-04T21:53:34Z")

</div>

Not manged to make any progress in the last couple of weeks with the error ☹

Would it be possible to make the pi boot to the raspberry pi os instead of Debian bullseye? Then I can use the original working python code!

---

<div class="post-metadata">

**Author:** ![alanb128](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/alanb128/32/2839_2.png) [@alanb128](https://forums.balena.io/u/alanb128)\
**Post date:** [June 21, 2024, 1:06am UTC](https://forums.balena.io/t/raspberry-pi-cam-module-3/370294/50 "2024-06-21T01:06:55Z")

</div>

Hello, are you suggesting trying to run Raspberry Pi OS in a container? I’m not sure that would solve your issue(s) which seem more related to containerization and port routing than anything missing from Debian Bullseye (the previous version of Raspberry Pi OS is basically Debian Bullseye with some tweaks as I understand it.)  
Perhaps start working backwards - try getting just the camera working in a single Dockerfile without docker-compose. Then you should have access to all ports and see what is going on. After that’s working, add back in the other container with docker-compose.

---

<div class="post-metadata">

**Author:** ![Jake1](https://avatars.discourse-cdn.com/v4/letter/j/73ab20/32.png) [@Jake1](https://forums.balena.io/u/Jake1)\
**Post date:** [June 21, 2024, 5:28am UTC](https://forums.balena.io/t/raspberry-pi-cam-module-3/370294/51 "2024-06-21T05:28:47Z")

</div>

Thanks @alanb128. I have already tried making a os as a container. It half worked but showed alot of errors and wouldn’t allow me to install applications 🙁 . I’m just currently attempting to get it to work with a more basic code like you have suggested. However balena doesn’t allow for a “preview” of the camera in the bash script which would probably explain why it isn’t working on the website server

Do you know any methods to override this?

Many thanks  
Jake

---

<div class="post-metadata">

**Author:** ![Jake1](https://avatars.discourse-cdn.com/v4/letter/j/73ab20/32.png) [@Jake1](https://forums.balena.io/u/Jake1)\
**Post date:** [June 25, 2024, 6:22pm UTC](https://forums.balena.io/t/raspberry-pi-cam-module-3/370294/52 "2024-06-25T18:22:56Z")

</div>

After a bit of trial and error I’ve managed to get the stream file working on it’s own however the web server is saying that it took too long to respond and i can’t figure out a way to fix this 🙁

Below are the logs from the Pi. I have also created a new directory which contains the code i’am currently running: [ALD-Models/Rail-Vista-Simplified · GitHub](https://github.com/ALD-Models/Rail-Vista-Simplified)

```auto
Started service 'camera sha256:3390db4dbf072d38adcd591cb84947b1e9aff43c8ce72e63ccbe20c9e5465e9f'
Releasing update locks
 camera Available cameras
 camera -----------------
 camera 0 : imx708 [4608x2592] (/base/soc/i2c0mux/i2c@1/imx708@1a)
 camera Modes: 'SRGGB10_CSI2P' : 1536x864 [120.13 fps - (768, 432)/3072x1728 crop]
 camera 2304x1296 [56.03 fps - (0, 0)/4608x2592 crop]
 camera 4608x2592 [14.35 fps - (0, 0)/4608x2592 crop]
 camera  
 camera Available controls for 4608x2592 SRGGB10_CSI2P mode:
 camera ----------------------------------------------------
 camera AeConstraintMode : [0..3]
 camera AeEnable : [false..true]
 camera AeExposureMode : [0..3]
 camera AeMeteringMode : [0..3]
 camera AfMetering : [0..1]
 camera AfMode : [0..2]
 camera AfPause : [0..2]
 camera AfRange : [0..2]
 camera AfSpeed : [0..1]
 camera AfTrigger : [0..1]
 camera AfWindows : [(0, 0)/0x0..(65535, 65535)/65535x65535]
 camera AnalogueGain : [1.122807..16.000000]
 camera AwbEnable : [false..true]
 camera AwbMode : [0..7]
 camera Brightness : [-1.000000..1.000000]
 camera ColourGains : [0.000000..32.000000]
 camera Contrast : [0.000000..32.000000]
 camera ExposureTime : [26..112015443]
 camera ExposureValue : [-8.000000..8.000000]
 camera FrameDurationLimits : [69669..220535845]
 camera LensPosition : [0.000000..32.000000]
 camera NoiseReductionMode : [0..4]
 camera Saturation : [0.000000..32.000000]
 camera ScalerCrop : [(0, 0)/64x64..(0, 0)/4608x2592]
 camera Sharpness : [0.000000..16.000000]
 camera  
 camera Server listening on port 80
 camera You can view the stream at http://172.17.0.2:80/
 camera [0:32:12.459547842] [103] INFO Camera camera_manager.cpp:297 libcamera v0.0.5+83-bde9b04f
 camera [0:32:12.602922676] [105] INFO RPI vc4.cpp:437 Registered camera /base/soc/i2c0mux/i2c@1/imx708@1a to Unicam device /dev/media3 and ISP device /dev/media1
 camera [0:32:12.603054620] [105] INFO RPI pipeline_base.cpp:1101 Using configuration file '/usr/share/libcamera/pipeline/rpi/vc4/rpi_apps.yaml'
 camera [0:32:12.605948027] [103] INFO Camera camera.cpp:1033 configuring streams: (0) 640x480-YUV420
 camera [0:32:12.613443268] [105] INFO RPI vc4.cpp:565 Sensor: /base/soc/i2c0mux/i2c@1/imx708@1a - Selected sensor format: 1536x864-SBGGR10_1X10 - Selected unicam format: 1536x864-pBAA

```

Any help would be massively appreciated!

Jake

---

<div class="post-metadata">

**Author:** ![Jake1](https://avatars.discourse-cdn.com/v4/letter/j/73ab20/32.png) [@Jake1](https://forums.balena.io/u/Jake1)\
**Post date:** [July 28, 2024, 8:09pm UTC](https://forums.balena.io/t/raspberry-pi-cam-module-3/370294/53 "2024-07-28T20:09:11Z")

</div>

Unfortunately, I haven’t made any progress with getting the pi camera to stream to a web server.

Could their be any firewall preventing me to stream the camera view to the port 80?

Jake

[Previous page](https://forums.balena.io/t/raspberry-pi-cam-module-3/370294.md?page=2)
