I am trying out online tutorial to practice python and raspberry pi.
I am currently following this tutorial:
http://learn.adafruit.com/drive-a-16x2-lcd-directly-with-a-raspberry-pi/wiring
It says a potentiometer is needed, but i dont have one...
The lcd I have is JHD162A
what will happen if i connect the circuit exactly the same but without a potentiometer?
will it destroy my pi or will it not work?
The pot is for the LCD contrast. If you do not connect it you will not destroy the LCD, but you might see nothing out of the LCD! You could try connecting pin 3 directly to 5V, this might give too high a contrast and it might come out completely black. If you have two fixed resistors, connect them in series, one end of the two to 5V, one end to ground and the junction of the two resistors to pin 3. A couple of 4k7 resistors would probably work fine.
Related
I'm working on a little project I wanted to see come to life using a NEOPIXEL WS2812B with a PI 4. I think I might be up against a hardware limitation and I'm curious if there's anyway around it. Heres the code I'm using
void send1()
{
//T1H
digitalWrite(DATA, HIGH);
//usleep(0.85);
//T1L
digitalWrite(DATA, LOW);
//usleep(0.4);
}
As you can see I've commented out the usleep stuff because I was having issues with the timing and I wanted to see the maximum switching speed I can get.
With that I get a switching speed of around 1.200us. The neopixels requires a 0.4 and 0.85us switching speed to work properly. Does anyone have any suggestions that can help get that number down? I'm just using a regular gpio pin. I'm rather new to playing around with the pi so I don't know all the tricks.
I did see this on pinout.xyz
The PWM0 output of GPIO 18 is particularly useful, in combination with
some fast, direct memory access trickery, for driving devices with
very specific timings. The WS2812 LEDs on the Unicorn HAT are a good
example of this in action.
That seems hopeful since the LEDs I'm using are the same model. but it doesn't really say much more about the tricks.
Direct Answer
You can try any of the following gpio libraries on rpi,
Rpi.GPIO (https://sourceforge.net/projects/raspberry-gpio-python/)
Gpiozero (https://gpiozero.readthedocs.io/)
Pigpio (http://abyz.me.uk/rpi/pigpio/)
Wiring Pi (deprecated, see author's statement)
Further Suggestion
It is not recommened to generate PWM signal directly from Raspberry Pi, because the linux kernel is not designed for real-time application and any other higher priority process could take over CPU from any running process, so basically you cannot make sure to have a constant PWM signal output. Probably NEOPIXEL LED will be flicking or changing color slightly in your case.
If you need better quality of PWM output, you are suggested to use a small I2C PWM module, e.g. many PCA9685-based boards. Your raspberry pi will control the module via I2C interface only when the value need to upadte, so your CPU are saved for your other applications.
I am trying to make some custom firmware for a MIDI controller (AKAI LPD8).
There is an STM32F102R8T6 chip in the unit.
I am trying to reach it with a programmer to wipe it, but it seems to not be responsive.
Some information and thing I have tried:
The firmware that came with the unit works, so the chip is not broken
Removed the components connected to the programming pins (PA9-PA10 and PA13-PA14)
I am able to pull BOOT0 high and have it not run the main program, but I am however not able to get a life sign using either an ST-Link2(clone) connected to PA13/14, nor a USB to serial adapter connected to PA9/PA10, so I am not sure what mode it is in
The connection has been checked, and RX-TX etc is the correct way around (but also for the sake of trying it all, I reversed the connections as well...).
Tried both the STM32CubeProgrammer and stm32flash, but none connects.
I am actually not sure if AKAI have locked the chip in such a way that you cannot even do a full chip erase and use the chip for something new? The NRST pin is strangely not doing anything to the running of the firmware either when I try to pull it low.
Is there a way to reprogram these chips when they come off of a commercial product, or are they permanently locked?
Any solution/tips?
Many of the STM32 parts have "proprietary code read-out protection" (google PCROP) which but you might be lucky and they haven't enabled it in the option bytes. Read the documentation for that and the bootloader documentation and get a good idea of what you expect it to do if it is enabled and if it isn't.
If you have a scope, try watching the SWD/JTAG pins to see if there is any response from the device. (If you aren't even sure if it is in reset then scope the crystal if there is one).
If you haven't got a scope, you might be able to to verify what it is doing by seeing if it sets the pins and pull-resistors to how they would be expected to be in the bootloader mode, eg: UART TX should be high if it is enabled, even it it isn't transmitting anything. Put a strong pull-down (~1k) on there and see if it still reads high.
After hours of trying different ways of making it work (also tried the alternate mapping of the UART port), and probed the TX pin as suggested by Tom V to no avail, I have given up working on that specific chip and ordered an upgrade from the STM32F4 family instead to replace it with. A lot more power and useful peripherals.
A bit of a non-answer to the specific question. Frustrating to not have found out what was wrong (chip or approach) but being mindful of the sunk cost fallacy, I think it was best to just replace the chip with a fresh one and start development from there.
we are using a STM32H743VIT6 on a custom board with a JLink debugger. Out of the blue the processor jumps in a state where it isn't possible to flash the ECU anymore. The board is running but nether JMem nor our IDE (uVision) are able to access or detect the controller. Has anyone else encountered this behaviour so far? Google wasn't helpful either.
It is almost impossible to archive unless you enable RDP (which is very hard to archive if it was not the intention of the programmer).
You probably have screw-up the board design. You should have pull-up resistors on the debug lines and NRST connected to the programmer.
If you do not have NRST available simple solder the wire to the NRST, and when the programming probe connects to the uC, connect it to the GND.
If the NRST line is connected to the programmer you need to select nn the configuration "Connect under Reset"
We found the answer to our problem. Like #0___________ suggested we had an error in the board design. The NRST line had a condensator which after sufficient loading was pulling the pin up and causing the board to permanently stay in Reset until it had time to unload. After a bit of soldering the problem was solved.
I'm working on a project that is using a Raspberry Pi with Raspbian and an SGTL5000 based sound card (FePi.) I have no problem selecting the card and getting samples in both directions - once I have configured the multiplexer to properly select line In/Out. I did this with Alsamixer. I want to automate the process so that the only step required is to run the application.
I don't see a way to do this using PyAudio/PortAudio. Is my only option the ALSA API or is there a way to do this with PyAudio (or PortAudio) that I'm not spotting?
Thanks in advance for any insight you can provide.
Oz (in DFW)
I ran into a similar problem, I wanted to automate changing mux settings but I wanted to adjust inputs not exposed by alsamixer too.
To deal with the limitations of the driver I ended up porting over the Teensy 3.x sgtl5000 control software to the pi yesterday
https://github.com/Swap-File/pi-sgtl5000
You could force feed the same commands via i2c via python.
The only downside is, once you start force feeding the sound card i2c commands, you break alsamixer (and anything else that might try to adjust it's own volume settings).
I'm not an Atmega pro by any means whatsoever. In fact, never worked with them. I'm trying to add an external eeprom using i2c interface to a device that uses an Atmega64 controller. From the datasheet, I see that pins 25 and 26 are labeled PD0/PD1 and are the SCL/SDA for i2c. That's fine and dandy. So then I go to the board and start tracing. I see that those go to a rocker switch with some simple circuitry that I haven't had a good look at yet, but I assumed it was something i2c compatible. But then what dawned on me was that this device has two such rockers so I expected to trace the other rocker back to the same two pins (since i2c is a bus that can have multiple slaves). Instead, they traced back to the two adjacent pins 27 and 28 labeled PD2/PD3 and RXD1/TXD1. Well, now that confused me.
I expected that I could add the memory in parallel on the SCL/SDA lines, but does what I now figure that what I discovered either means:
SCL/SDA is interchangeable with RXD1/RXD2 or
I'm confused on how SCL/SDA works and its not a bus or it can be used as a simple input?
Sadly, I'm not really sure what I'm asking. Can someone shed some light on this? Should I still be able to add the memory to SCL/SDA or probably not?
Thanks.
Steve
Nevermind, I found the answer. Its BOTH a bus and a simple input... either one or the other. In this case, its being used as an input so I can't also use it as a bus. Darn. Oh well.