I am trying to connect the Black Swift with an display from Parallalax[1]. I have been reading lots of tutorials about that but with the displays being used on the tutorials there is always a difference to the pins on my display. The displays that are being used usually have lots of pins where you can choose the ones you need, but the display I have just has 3 pins (5V, GND, RX). Now I assume that with this RX pin I can control the display (like when I use lots of pins on other displays). But I dont know where to connect that RX pin on my Black Swift. The next thing is,
I have also read the manual on that display I have (the link I provided) but the examples they use there are all built up on some boards that are being sold on the website (for example nothing about how to connect a raspberry or arduino). When reading a tutorial everything seems pretty easy, but I guess I didnt choose my hardware wisely :(
Now my question, since I am new to this, is it possible to connect that display to some random microcontroller (in my case Black Swift) ? If yes, where should I connect that RX pin? What is this RX pin doing, (didnt find anything in the manual about that)? Since they are using some special way (PBasic?) to control the display (is inside the manual), is it be possible to control the display with pythong?
Thanks for the help
EDIT:
So far I have managed to turn on/off the UART mode, and it seems that this is not the issue bcz I am getting same results (weired characters on te display).
[1] https://www.parallax.com/sites/default/files/downloads/27979-Parallax-Serial-LCDs-Product-Guide-v3.1.pdf
The linked PDF tells the story pretty conclusively. You need a UART from your controller with the matching bps-rate as set up by the DIP-switches.
Following http://www.black-swift.com/wiki/index.php/File:BlackSwift-1.0-pinout.png you should connect GPIO10/UART_TX to the RX, and then program your uC in whatever language it supports.
Related
I’m quite new to programming world so this might be a really basic question.
Currently, I’m trying to switch on/off of LED on Arduino by using Python (pyserial).
I found some examples that require key input like on or off after running.py
That example codes actually worked with my device, but I want it without key input and couldn’t find that examples.
I mean if I run LED_ON.py, Python automatically sends on signal to Arduino and LED should be ON. Then to turn it off, close LED_ON.py and just run LED_OFF.py
Is my plan can be implemented?? 😖
TL;DR- Python listens to live audio and reacts accordingly on the go.
I am a complete beginner to Python, this is my first idea i'd love to work on. So it all began with me "hacking" my LED strips i have connected to WiFi. I can easily switch their color by launching a file and make them do certain pattern one time (haven't tried repeated/infinite patterns). My goal is to make it listen to music played on computer (essentially listen to system sounds one could say) and analyze the low bands and depending on the intensity of them, change the LED colors. As example music plays and lights switch color on each beat.
I haven't tried anything so far.
Lights work completely fine as i enter custom RGB and brightness values.
I am an absolute N00b when it comes to Python and I have no idea how to turn my 'sudo'- code into actual code.I'm also having issues with the GPIO pins in my pi.
I would very much like some help coding this project.
I've tried making separate codes to test the GPIO pins but they never seem to work properly, I'm not using any resistors and I probably should even though I have no idea which ones and where.
I have tried to use the Bluetooth speaker with my pi but it always seems to prefer the HDMI even though I try to force it to Bluetooth, it just won't go.
I have been learning python in my free time as much as I can but since I am a full-time student, I haven't been able to learn very much and my knowledge of c++ has been entirely useless so far.
This is my sudo code
loop(called while on)
if(handset is on the cradle)
Do nothing and loop “while on” again
else
Clear Code
loop(called dialing loop)
If (time<3seconds)
Play dialtone.mp3
if(number indicator is off)
Stop playing dialtone.mp3
Reset time
Count number of pulses from #pulser
Assign number to the next letter of Code
Exit to dialing loop
Else
Start counting time
Exit to dialing loop
Else
Search thumbstick for Code.mp3
if (Code.mp3 exists)
Play Code.mp3
Exit to while on loop
Else
Play dropped call.mp3 for 3 seconds
Exit to dialing loop
My goal is to use an old rotary phone with a raspberry pi that will let you dial a number (arbitrary length) an audio file associated with that number (one file per number-one number per file) will be played through the handset. My restrictions are: the files and codes must be read from a thumb drive, there must not be a cap on the number of files, there must not be a cap on the length of the number you can dial, all the outward facing parts of the phone must look like the original phone, it must be a raspberry pi. the dial on the phone uses two leaf switches, one that pulses an amount of times based on the number that is dialed and one that is active until a user starts to dial a number. There is a needle switch attached to the cradle that will detect whether or not the handset is on the cradle and the audio is being played through a Bluetooth speaker.
You could always start here: https://leanpub.com/RPiMRE
You can read it online for free: Here's a section on GPIO:
https://leanpub.com/RPiMRE/read#leanpub-auto-pin-header-1
Again it's free and a good resource with code examples on how to map what you're looking to do for your project. It might not be straight away what you're looking for but might have some bits that can help you. Good Luck!
I dont know why is this happening but am quite pissed off :-), because am struggling with this for two days now..
HW:
Arduino board --> Raspberry Model 2 B
Am sending one second impulse from arduino mega digital pin 8 to raspberry.
I added voltage divider so i have clean 3,25V impulse.
RSP reads most of impulses correctly but sometimes i get false readings.
E.g. one impulse is triggered and few are not or it starts to trigger impulses but I didn't send any from arduino side.
I try with pullup, pulldown setup but the problem is the same.
Maybe i should define that the "impulse" is value that last 1 second and everything else is "garbage" ?. If so, how to make this ?
CODE:
GPIO.setmode(GPIO.BCM)
GPIO.setup(24, GPIO.IN, pull_up_down=GPIO.PUD_UP)
#GPIO.setup(24, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)
...
GPIO.Cleanup()
The funny part is that if i test the impulse from RSP 3,3V pin, it works every time ( of course with pull_down setup ). So, what could be a problem ?
3,3V and 3,25 is no difference at all and RSP defines HIGH from 2.8 - 3.3V...
Any ideas ?
For me, it's more a matter of electronic.
In fact, for that kind of library, we can assume that the functions work correctly (I suppose that you wrote correct code that was built like that: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/robot/buttons_and_switches/).
I believe that the electronic problem can come from several sources:
Either your ground is badly connected (or it's not the same for the arduino and the rasperry pi). So, the reference tension isn't the same and a 0V for the arduino can be 1V for the raspberry pi.
It can also be a result of a bad interpretation of when your circuit is on and off. Don't forget that to put a plain 0V in the input of the raspberry pi (when the circuit is off). You need to explicitly write 0V at the output of the arduino (I mean: digitalWrite(ledPin, LOW);) otherwise your pin would not be "grounded" but "floating" and the tension can fluctuate from any value (close to 0) to another depending on environmental factors.
(to achieve it, you can also use pull down resistances, see: http://playground.arduino.cc/CommonTopics/PullUpDownResistor).
It can also be a transient phenomenon due to unwanted capacitive reactions. So, when your current changes quickly, the circuit cannot follow it instantaneously and it will produce some voltage glitches.
I suggest checking the two first points. If it cannot solve your problem, it should be related to the second point and you could handle it with capacitors and wait times.
I hope it will help :)
Thank you for replay. This are the test's that I made today.
- I have connected the zener diode to get the 3,3v and this part is good
- tested with different impulse lengths
None of them worked.
It's interesting, if i start the RSP script and if i just wait for impulse ( without triggering it ) i will get some 30 reading in few minutes. So it looks like that there is something going on.
I disabled this part of the code in arduino, but i still get this readings...
Btw. should i connect arduino and rsp GND together ?
E.
I want to try something that I imagine is somewhat simple. I want to have a USB cable with an LED on it, and a python script that would have 2 possible arguments: "on" and "off". This would toggle the LED on and off (obviously). So, anyone who knows software know which libraries (if not libusb) to use and how to use them, and hardware people, know how I might make said circuit? I don't want to turn the USB's power supply off, I just want to change something in the circuit to disable the LED.
USB is a serial protocol; you can't just set it "on" or "off", the way you used to be able to set a parallel port pin.
You need something (ie an embedded microprocessor) on the far end; the computer talks to the microprocessor which drives the LED.
Take a look at an Arduino; they are cheap, readily available, and easy to use.
Edit: try the Teensy - completely Arduino-compatible, $16, just over an inch square, has a USB port and 25 I/O pins.