Go to advanced search

by ddahms
Fri Jun 18, 2021 11:01 pm
Forum: Interfacing (DSI, CSI, I2C, etc.)
Topic: RGB LCD1602 | Detected, but not working
Replies: 11
Views: 1075

Re: RGB LCD1602 | Detected, but not working

I2C has a 7-bit address range. The address is shifted left one bit when the R/W bit is added. Sometimes companies specify the address including this shift. In this case the example code you referenced defines the address as: LCD_ADDRESS = (0x7c>>1) RGB_ADDRESS = (0xc0>>1) and indeed those two values...
by ddahms
Sun Apr 11, 2021 6:27 pm
Forum: Advanced users
Topic: solved: different result when using GPIO from userland or from kernel module
Replies: 9
Views: 532

Re: different result when using GPIO from userland or from kernel module

One thing looks suspicious to me: This bit of code is not doing what I think you intended. if ((mask && current_bit_mask) == 1) { out_mask |= gpio_pin; Perhaps something like this: if (mask & current_bit_mask) { out_mask |= gpio_pin; Depending on the values of the function parameters, it...
by ddahms
Sat Mar 20, 2021 8:13 pm
Forum: Interfacing (DSI, CSI, I2C, etc.)
Topic: Fluctuating values from MCP3008 with Op Amp AD822
Replies: 8
Views: 632

Re: Fluctuating values from MCP3008 with Op Amp AD822

For a first step, again I suggest testing the MCP3008 by connecting a known voltage to an input and then see if you read a reasonable value. If that is not working, the rest of the circuit does not matter. Next step: the opamp circuit looks ok as is. It should produce a voltage across the 10uF capac...
by ddahms
Wed Mar 17, 2021 4:42 pm
Forum: Interfacing (DSI, CSI, I2C, etc.)
Topic: Fluctuating values from MCP3008 with Op Amp AD822
Replies: 8
Views: 632

Re: Fluctuating values from MCP3008 with Op Amp AD822

The battery - terminal and op amp ground must be connected to the MCP3008 ground and Pi ground.
by ddahms
Wed Mar 17, 2021 2:38 am
Forum: Interfacing (DSI, CSI, I2C, etc.)
Topic: Fluctuating values from MCP3008 with Op Amp AD822
Replies: 8
Views: 632

Re: Fluctuating values from MCP3008 with Op Amp AD822

Is the ground of the op amp connected to the ground on the Pi? If so, next you could verify the MCP3008 is working correctly. Connect input #2 to 3.3V and see what it reads. Then you could create some intermediate voltage with a resistor divider and see if you get a sensible reading. That 178 ohm re...
by ddahms
Fri Mar 12, 2021 11:33 pm
Forum: Interfacing (DSI, CSI, I2C, etc.)
Topic: Interfacing Pi400 to MCP23017/MCP23018 - why can't I get it to work?
Replies: 7
Views: 750

Re: Interfacing Pi400 to MCP23017/MCP23018 - why can't I get it to work?

RESET is on pin 16, not 14.

Also, I think ADDR being tied high will add 7 to its I2C address, if it responds at all.
by ddahms
Mon Feb 01, 2021 11:20 pm
Forum: C/C++
Topic: ioctl i2c read/write problems
Replies: 3
Views: 679

Re: ioctl i2c read/write problems

There is one thing that looks suspicious to me. The i2c_msg structure has a member called "flags" and your code leaves it uninitialized in two of three places. Try setting it to 0.
by ddahms
Sat Jan 09, 2021 3:26 am
Forum: Automation, sensing and robotics
Topic: Problem measuring DC current with ADS712 (with code)
Replies: 8
Views: 537

Re: Problem measuring DC current with ADS712 (with code)

Consider that the current drawn by an inverter is not constant over the period of the sine output. This is especially true of a so-called "modified sine" inverter that has significant dead time around the zero crossing points when it draws nearly no current. The ADS712 appears to have plen...
by ddahms
Sat Dec 12, 2020 5:57 pm
Forum: Interfacing (DSI, CSI, I2C, etc.)
Topic: Convert Raw value into voltage in an ADC
Replies: 2
Views: 381

Re: Convert Raw value into voltage in an ADC

The ADS1015 has an internal voltage reference which is fixed at 4.096V. So your initial statement about Vref=5V is wrong and is causing the confusion. The table 3 specifies a range of +/-4.096V so a 12-bit converter with 4096 steps means each step is 2mV when gain=1. If you set the gain to 16, then ...
by ddahms
Mon Aug 03, 2020 3:05 pm
Forum: Automation, sensing and robotics
Topic: Hardware PWM and DS18B20 temperature sensor
Replies: 10
Views: 1095

Re: Hardware PWM and DS18B20 temperature sensor

You might try increasing C1 to 10uf or 100uF. A second idea is to add a second 10K resistor and 10uF capacitor to make a two-stage filter.
by ddahms
Fri Aug 30, 2019 9:07 pm
Forum: Camera board
Topic: Custom lens shading tables
Replies: 95
Views: 29938

Re: Custom lens shading tables

Mrlbppy:

Try doing rpi-update now. The initial implementation of the new AWB algorithm had a bug which broke the lens shading tables. It has been fixed in the newest firmware which rpi-update will install.
by ddahms
Thu Jun 06, 2019 8:45 pm
Forum: Camera board
Topic: New AWB algorithm in test firmware
Replies: 25
Views: 9282

Re: New AWB algorithm in test firmware

I gave it a try. I have a v1 camera. On a sunny midday scene, I see no difference between mode 0 and 1. On a dusk scene, mode 0 has an overall reddish tint like it always did while mode 1 is less reddish, which is an improvement. There is one minor side effect: in mode 1, the version of Raspistill t...
by ddahms
Fri May 17, 2019 5:42 pm
Forum: C/C++
Topic: SparkFun LIS3DH SPI communication using wiringPi
Replies: 4
Views: 1787

Re: SparkFun LIS3DH SPI communication using wiringPi

One minor problem is that you declare buffer[10] but then put 11 things into it. However I think the problem is more basic than that. There is an app note on the Sparkfun site (here) that explains the registers and the initialization procedure.
by ddahms
Tue Apr 10, 2018 5:08 pm
Forum: Automation, sensing and robotics
Topic: how to control 24VDC valve with ULN2803A?
Replies: 25
Views: 7700

Re: how to control 24VDC valve with ULN2803A?

The "+24Vdc to pin 18 of the ULN 2803A" connection should be removed. Additionally you must attach the other wire from the +24V supply to the "GND of RPi to pin 9 of the ULN2803A" connection that you already made.
by ddahms
Mon Mar 12, 2018 2:14 am
Forum: Interfacing (DSI, CSI, I2C, etc.)
Topic: MCP3008 troubleshooting
Replies: 33
Views: 9399

Re: MCP3008 troubleshooting

I agree that it is highly unlikely you have managed to damage just the SPI section of the chip on two separate Pi boards. Are you moving the SD card back and forth between the two PIs? About all I can suggest now is to try a fresh install of minimal Raspbian, use raspi-config to enable SPI only, con...
by ddahms
Sat Mar 10, 2018 4:08 am
Forum: Interfacing (DSI, CSI, I2C, etc.)
Topic: MCP3008 troubleshooting
Replies: 33
Views: 9399

Re: MCP3008 troubleshooting

I ran the loopback test on my own Pi. Curiously, the C version passed but the Python version failed. This is because the C version sets the transfer speed and the Python version does not, so it runs at the default speed of 125MHz and it can't even keep up with itself. Slowing that down by inserting ...
by ddahms
Thu Mar 08, 2018 8:06 pm
Forum: Interfacing (DSI, CSI, I2C, etc.)
Topic: MCP3008 troubleshooting
Replies: 33
Views: 9399

Re: MCP3008 troubleshooting

As I understand the situation, presently it works using software-SPI and returns believable values. With hardware-SPI, it always returns zeros, and Piscope shows the SPI signals don't even move. To me, this feels like a Pi software or configuration issue. Does the /dev/spidev0.0 file exist, with crw...
by ddahms
Thu Mar 08, 2018 2:43 am
Forum: Interfacing (DSI, CSI, I2C, etc.)
Topic: MCP3008 troubleshooting
Replies: 33
Views: 9399

Re: MCP3008 troubleshooting

I suggest one easy experiment--move your green wire to GND instead of 3,3V and see if your reading of 1023 changes to 0. This will tell you if the Pi is actually talking to the chip or not. If it does change, then try connecting 1 or 2 volts to pin 1 and see what reading it gives. You can create tha...
by ddahms
Sat Feb 24, 2018 2:47 am
Forum: Interfacing (DSI, CSI, I2C, etc.)
Topic: Reading Values from 12-bit ADC with Python with I2C
Replies: 7
Views: 5331

Re: Reading Values from 12-bit ADC with Python with I2C

The datasheet says to put a 2.2uF cap on Vref pin 20, and a 10uF and 0.1uF cap on REFCOMP pin 1. Perhaps your circuit is oscillating without these caps. It might not be the cause of your problem but it can't hurt.
by ddahms
Tue Feb 13, 2018 6:15 pm
Forum: Beginners
Topic: set up SSd1331 OLED for pi3. Please help.
Replies: 2
Views: 935

Re: set up SSd1331 OLED for pi3. Please help.

The python code in the repo uses different pins than you have specified. Several places in the code it says: SSD1331_PIN_CS = 23 SSD1331_PIN_DC = 24 SSD1331_PIN_RST = 25 which is different than your wiring. Those are GPIO numbers, not pins on the connector. Look carefully at the wiring diagram in th...
by ddahms
Tue Feb 13, 2018 4:35 pm
Forum: Beginners
Topic: i2c or spi?
Replies: 12
Views: 2969

Re: i2c or spi?

This repo has example code and a pictorial connection diagram.
https://gist.github.com/TheRayTracer/dd ... ecb9b8b47f
by ddahms
Thu Feb 08, 2018 5:34 pm
Forum: Beginners
Topic: i2c or spi?
Replies: 12
Views: 2969

Re: i2c or spi?

I think the board labels are confusing. The SSD1331 chip supports SPI (plus two archaic parallel modes) but not I2C. The SSD1331 datasheet and board schematic are in the rar. In SPI mode, data goes in on the D1 pin of the chip which is labeled SDA on the board. Clk goes in on D0 which is labeled SCL...
by ddahms
Thu Sep 28, 2017 4:19 pm
Forum: Camera board
Topic: 8mp Camera Optical Zoom Lens options
Replies: 2
Views: 2678

Re: 8mp Camera Optical Zoom Lens options

To use a lens like this, you have to remove the camera's existing lens, by unscrewing it from the camera body. Then you need a M12 lens holder to hold the new lens in position. Generic ones are readily available on eBay but they need some mechanical modifications to fit on a Pi camera. M12lenses.com...
by ddahms
Wed Aug 16, 2017 3:04 pm
Forum: Camera board
Topic: Custom lens shading tables
Replies: 95
Views: 29938

Re: Custom lens shading tables

Everything I tried seemed to have no effect, and I discovered why. The lens_shading_analyse program writes the file "ls_table.h" but RaspiStill.c includes the file "ls_grid.h" and completely ignores "ls_table.h". I had copied ls_grid.h from 6x9's repo along with the mod...
by ddahms
Sun Aug 13, 2017 9:32 pm
Forum: Camera board
Topic: Custom lens shading tables
Replies: 95
Views: 29938

Re: Custom lens shading tables

I gave this a try. It definitely changed the colors of the image but it still looks wrong. My camera is a v1.3 with a 3.6mm M12 lens (because I screwed up the original lens by trying to clean it). I think I followed your procedure correctly: point camera at white cardboard, run "raspistill -o s...

Go to advanced search