HomePage | RecentChanges | Preferences

Raspberry Pi


Inspiration: https://www.amazon.com/4UCAM-Backup-Camera-iPhone-Android/dp/B00HWB91VY

rpi and camera in truck bed, connected to iphone's wifi (or bluetooth?) displaying video of trailer hitch.

raspivid -> iphone, bluetooth? mjpeg in a web browser? (might have too much lag)


https://www.sunfounder.com/rpi2-sensorv2.html from https://www.youtube.com/watch?v=5sRVThYE6to

edit /etc/default/keyboard and change gb to us - https://www.youtube.com/watch?v=L1F-TxTPyiM





single led on breadboard https://projects.drogon.net/raspberry-pi/gpio-examples/tux-crossing/gpio-examples-1-a-single-led/

https://twitter.com/lovclrtxt/status/679580479335436288 Computer Programmer@lovclrtxt Firmata library in @elixirlang to control an @arduino from @NervesProject? on a @Raspberry_Pi or @beagleboardorg https://github.com/kfatehi/firmata



Blinking an LED using sysfs and a GPIO pin: http://wtfleming.github.io/2015/12/10/embedded-elixir-raspberry-pi/





the python library https://github.com/adafruit/Adafruit-Raspberry-Pi-Python-Code/blob/master/Adafruit_PWM_Servo_Driver/Adafruit_PWM_Servo_Driver.py

lower level... http://www.raspberry-projects.com/pi/programming-in-python/i2c-programming-in-python/using-the-i2c-interface-2


elixir_ale https://github.com/fhunleth/elixir_ale

Controlling multiple servos / robot arm in python http://www.usefulramblings.org/?page_id=5875




fhunleth [10:59 PM] @wsmoak: the datasheet looks like the right one. I'm not sure how far you got, but the goal is to get the PCA9685 to generate a PWM signal with a period of 20 ms (or close to that) and be able to vary the on time from 1 to 2 ms. 1.5 ms should make the servo turn to the middle of its range, <1.5 ms will turn it one way and >1.5ms will turn it the other. If you have a logic analyzer, it will come in handy to check what the PCA9685 is doing. I didn't take a look at the Adafruit Python code, but there should be writes to the MODE registers (see section 7.3 of the datasheet), maybe the PRE_SCALE register, and then the LED0_* registers. If you replicate the values that they write, it should do something. One idea would be to put prints in the Adafruit Python code every time it does an I2C write to see what values it uses.

fhunleth [11:25 PM] Scratch what I said about the 20 ms period. It looks like Adafruit's Python code likes to drive the PWM at 60 Hz (16.6 ms). They're using the internal oscillator on the PCA9685 which runs at 25 MHz. The datasheet tells you what to set the PRE_SCALE register for a 60 Hz signal: round(25000000/4096/60)-1 = 101. Set the LED0_ON_ registers to 0, so that the PWM signal go high at the beginning of the period, and then set the LED0_OFF_ registers to make the PWM signal go low after 1 to 2 ms. The units are 16.6ms/4096=4 us, so 369 gives about 1.5 ms and hopefully makes the servo turn to the middle.(edited)

​[11:26] There's some funky stuff with setting the mode registers to put the chip into sleep mode before setting PRE_SCALE. Presumably if you do exactly what the Python code does, it will work... :simple_smile:

​[11:27] Good luck!


Here's the talk with streaming video on the RPi: https://www.youtube.com/watch?v=tCg1LakJF3g&list=PLWbHc_FXPo2h0sJW6X2RZDtT1ndw6KKpQ&index=28 YouTube? Erlang Solutions Erlang Factory SF 2015 - Frank Hunleth - Embedded Erlang, Nerves, and SumoBots?

​[5:19] A small warning: I haven't documented the camera pieces so it's not the easiest.

​[5:20] The source code may help some: https://github.com/fhunleth/elixirbot

Interrupts with VCNL4010

fhunleth [7:05 PM] @wsmoak: ok, good. I should have said open drain (they're almost the same thing). The reason that you didn't need to add pull up resistors to the I2C SDA and SCL lines is because the Raspberry Pi has them on the board. The term "pull up" just refers to the function of the resistors. They're normal resistors. The idea is that an open drain output either supplies 0 V or acts like it is disconnected. Since the Raspberry Pi doesn't know what the status of the input is when it is disconnected, you connect a pull-up resistor between it and 3.3 V (often just labelled 3 V). That way when the output is acting like it's disconnected, the 3.3 V going through the pull-up resistor wins and the Raspberry Pi sees a `1`. When the output is supplying 0 V directly, the voltage on the Raspberry Pi's input is really close to 0 V and so it sees a `0`.

fhunleth [7:07 PM] The reason that chips work like this is so that you can connect more than one of their interrupt lines to the same pin on the Raspberry Pi. When any one of them has an interrupt, the Raspberry Pi will be notified and then it can ask each chip whether it is in the interrupt state. It's less important on the Raspberry Pi, but on some microcontrollers there's only one or a couple interrupt pins, so being able to share them is important.

HomePage | RecentChanges | Preferences
This page is read-only | View other revisions
Last edited July 4, 2017 1:18 pm by 133-94-98-198.dsl.wavetel.us (diff)