Archive | Electronics

On Wiring up a New Project

I’ve been working on an interactive art project as a favour for a friend of mine that would allow you to push buttons, use rotary encoders, potentiometers and so on in order to control an animated light fixture elsewhere in the room.

These controls would allow you to change:

  • Brightness
  • Display mode
  • Palettes
  • Speed
  • Toggle direction
  • Toggle glitter
  • and so on. . .

To do so, I’m using an ESP8266 enabled FastLED based lantern combined with an ESP32 based control panel. They’re both MQTT enabled, and I’ll be using an Android phone as the wifi hotspot and MQTT broker.

Here’s an email I sent about my progress in wiring and initial coding for the control panel:

I finished wiring up all the pins this morning and . . .

ABSOLUTELY NOTHING WORKED. Wouldn’t even upload to the ESP32. Got out the voltmeter and started measuring:

  1. LED was wired backwards (causing it to not upload), so I removed it temporarily.
  2. Some pins didn’t support internal pullup so I had to do some research and re-wiring.
  3. Didn’t set internal pullup correctly in the code. Found and fixed.
  4. Got digital pins working with basic digitalRead().
  5. Found an ESP32 button library, so I don’t have to worry about de-bouncing.
  6. Got that working with multiple buttons.
  7. Had to rename the analog ports and got the potentiometers working. Values were backwards, but math fixed that.
  8. Had previously successfully tested a rotary encoder library, so I added the code.
  9. One rotary encoder wasn’t working. Swapped wires, was the same encoder. Pins were OK.
  10. Had a rotary encoder soldering issue (solder blob). Fixed that and got both working as well.
  11. Soldered on a new WS2812 LED. Installed FastLED and got that working once I found a compatible pin.
  12. Got some ESP32 network code. It compiled.
  13. Got my old MQTT networking code. It compiled as well.
  14. Have smushed together my wifi/MQTT code with FastLED and the various inputs.
  15. Amazingly, it all still compiled.

Next step will be to start adding MQTT publishing functionality to each of those inputs.

So far so good. This shit takes time to do though. As <other friend> well knows, it can take a LOT of time.

In summary, things typically don’t go as expected, so it can boil down to troubleshooting techniques. Divide and conquer.

Update: The next day, I had the buttons and potentiometer working just peachy. Only problem is, that my mode selector was meant for buttons and I was trying to use a rotary encoder for that. Now have to change code for both the control panel as well as the lantern to accept the values provided by the rotary encoder. Have also got the LED on the control panel to show Red when there’s no network connectivity, Orange when it’s connected, and finally Green when both wifi and MQTT are connected.

Continue Reading

Getting Started with ESP8266 and MQTT

Being able to control an Arduino remotely really ups our automation game. In the beginning, it was buttons and potentiometers and from there, we graduated to Infra Red remote control.

With the widespread availability of IoT (Internet of Things) functionality, we now have Internet connectivity to our Arduino compatible microcontrollers. One method is to setup our Arduino as a web server, and Jason Coon’s ESP8266 webserver is a prime example.

Another option is a messaging protocol called MQTT (Message Queuing Telemetry Transport) which provides a lightweight method of controlling IoT devices, and in this case an ESP8266 based microcontroller.

This tutorial goes through the steps of setting up an Android phone and an ESP8266 based WeMOS D1 Mini with MQTT controls to turn the internal LED of the ESP8266 on and off.

Continue Reading →
Continue Reading

Arduino Christmas Lights

With the recent purchase of an Arduino microcontroller, my interest in electronics was rekindled after many years hiatus. One of my goals back in the day was to create a colour organ where lghts would flash in beat with the music. With the Arduino, I can easily do that and much more, so I set about coming up with a project that made use of modern day LED’s. The result will be Christmas lights that:

Continue Reading →

Continue Reading

Costing a FastLED Display Locally

Here’s an approximate cost breakdown if I were to head into some local electronics stores to purchase components for my portable displays:

Miscellaneous items include zip tie, solder, a few sizes of heat shrink tubing.

Then there’s my labour at a minimum of $40/hr and it takes about 45 minutes to build one.

Oh, did I mention all the time I spent learning/developing the coding and techniques?

Continue Reading

Electronics Links

FSM

  • http://www.cs.washington.edu/education/courses/cse370/99sp/sections/may18/slides/sld002.htm

 

Amplifiers

  • http://www.electronics-tutorials.ws/amplifier/amp_2.html
  •  

    Good Links

  • http://tristesse.org/FPGA/CheapFPGADevelopmentBoards
  •  

    Courses

    • https://www.youtube.com/watch?v=JtXvUoPx4Qs&feature=youtu.be
    • http://scale.engin.brown.edu/classes/EN164S11/
    • http://www-inst.eecs.berkeley.edu/~cs150/sp13/agenda/
    • http://www.newae.com/tiki-index.php?page=IntroToDigitalCircuits
    • http://engineering.purdue.edu/~ece437l
    • http://ecee.colorado.edu/~ecen2350/AlteraSoftware/
    • http://mil.ufl.edu/3701/gcpu.html
    • http://engineering.purdue.edu/~ece437l
    • http://6004.mit.edu
    • http://www.cecs.csulb.edu/~rallison/pdf/

     

    Online Labs

    • http://teahlab.com
    • http://tams-www.informatik.uni-hamburg.de/applets/hades/webdemos/16-flipflops/10-srff/clocked-srff.html

     

    Cypress SoC Links

    I was given a Cypress PSoC 3 development kit. This includes an 8051 controller, programmable logic along with various analog components. The development software allows for visual design, lots of components in the libraries as well as programming in C. Oh, and I now have a PSoC 4 as well.

     

    TI MSP430

    I purchased this at the 2013 Vancouver Mini Maker Faire for $11.

     

    Bora Binary Explorer Links

    I purchased this board through the Kickstarter program. This board includes a Xilinx XC9572XL CPLD, which gives you equivalent to around 1600 gates.

     

    Altera FPGA Links

    I purchased an Altera DE1 development kit, which includes a Cyclone II FPGA. What an awesome looking board. 

     

    Altera De1

     

    Xilinx Links

    • http://www.digilentinc.com/Products/Catalog.cfm?NavPath=2,400&Cat=10
    • http://hamsterworks.co.nz/mediawiki/index.php/FPGA_course

     

    Verilog Links

    • http://cjdrake.github.io/verilog-flip-flop-macros.html
    • http://www.ee.ed.ac.uk/~gerard/Teach/Verilog/manual/index.html
    • http://vol.verilog.com/VOL/main.htm
    • http://www.asic-world.com/verilog/veritut.html
    • http://electrosofts.com/verilog/
    • http://sutherland-hdl.com/online_verilog_ref_guide/verilog_2001_ref_guide.pdf
    • http://www.verilogwiki.info/wiki/index.php/Tutorials
    • http://openhpsdr.org/wiki/index.php?title=Verilog

     

    VHDL Links

    • They would go here!

     

    CPU’s

     

    CPU Design

     

    Links Sites

    • http://homebrewcpu.com/links.htm
    • http://www.faqs.org/docs/Linux-HOWTO/CPU-Design-HOWTO.html#ss4.1

     

    Digital Simulators (see Altera for Modelsim)

     

    Analog Simulators

    • http://www.linear.com/designtools/software/#LTspice 
    • http://www.new-wave-concepts.com/pr/livewire.html 

     

    Books

    • Digital Design And Computer Architecture
    • Digital Design Principles And Practices
    • Fundamentals of Logic Design
    Continue Reading

    Arduino Resources

    References

    • http://vancouverroboticsclub.org

    Suppliers

    • http://www.seeedstudio.com
    • http://arduino-direct.com
    • http://www.makershed.com
    • http://www.adafruit.com
    • http://www.sparkfun.com
    • http://www.robotshop.com (Canada)
    • http://www.rpelectronics.com (Vancouver)
    • http://www.mainelectronics.com (Vancouver)

    Continue Reading →

    Continue Reading