Tuesday, November 24, 2015

P2 - ESP8266 DevBoard - CBDB nEXT EVO - Firmware


  Part 2 of the the new ESP8266 nEXT Evolution Board Series


--------------------------------------------------------------------------------------------------------------------------
For any new CBDB orders/requests please feel free to use as usual:
     tech at esp8266-projects.com.

CBDB nEXT Evo bare PCB has also been made available directly at Dirty PCBs, our preferred PCB House for experimenting (**):
 http://dirtypcbs.com/view.php?share=9699&accesskey=91d782fd4a10943fd36ecc371c7ff2cd


(**) - Actually you have there 2 Boards for the price of one, a CBDB nEXT Evo together with a secondary nEXT Extesion Board that brings you a 18Bit ADC (autoscale 0-40V input!), 4x12Bit DAC, Precison Temperature measurement, 8bit I/O port, etc. But more about this one in the next articles.  -------------------------------------------------------------------------------------------------------------------------



First thing to see is how easy is the process to configure and start using CBCB nEXT EVO Board. It will come preconfigured with NodeMCU, so, if LUA is your desired programming language you can just start using it.

   In case of firmware update needed or if you want to change the environment, it is a very easy process, almost similar with the one used for MPSM Board for example.




What we will need:




Uploading  new firmware:


  • connect CBDB nEXT EVO Board with the USB Cable.
  •  Press PROG + RESET Buttons and power up (plug it into PC USB port)
  • Start NodeMCU Flasher. Choose you USB adapter corresponding port
  • Add from Config Menu latest previously downloaded firmware. It must start from 0x0000. Disable anything else. 
  • Go back on Operation tab. Power off your CBDB Module. Press FLASH Button. power ON quick CBDB module. It will be recognised and will start flashing. Give it a second try if necessary.
  •  When finished succesfully A green OK checkmark will appear
  •  Power Off CBDB Module, Remove yellow jumper. Power back ON. Your nEXT EVO Board should be now programmed with the new NodeMCU Firmware.

If you have trouble to keep pressed both PROG and RESET buttons ,you can use a jumper from GPIO to GND as a replacement for PROG button and press just RESET when necessary:








For further programming in LUA, it might be possible to do it directly in your Serial Terminal Program but I will recomend you to use a more dedicated program for that, like ESPlorer or LuaUploader. I will stay with the latest one, for it's great flexibility and simplicity.

   To run a quick test, you can just use the code snippets provided by LuaUploader at start-up. Select the piece of code that you want to run and press "Execute Selection" button.


  • To quick setup your WIFI network :
        -- One time ESP Setup --
        wifi.setmode(wifi.STATION)
         wifi.sta.config ( "YOUR_WIFI_SSID" , "PASSWORD" ) 
         print(wifi.sta.getip())


  • For the Blinky test we will use the onboard LED connected to GPIO2 and run the code from below

                -- Blink using timer alarm --
                timerId = 0 -- we have seven timers! 0..6
                dly = 500 -- milliseconds
                ledPin = 4 -- 4=GPIO2
                gpio.mode(ledPin,gpio.OUTPUT)
               ledState = 0
               tmr.alarm( timerId, dly, 1, function()
                  ledState = 1 - ledState;
                  gpio.write(ledPin, ledState)
               end)









 For all the Arduino IDE lovers:

Arduino IDE first test for direct programming and firmware uploading on the new ESP8266 CBDB nEXT EVO DevBoard.

 Running Blinky LED program on GPIO2:

// the setup function runs once when you press reset or power the board
void setup() {
     // initialize digital pin 2 as an output - GPIO2
     pinMode(4, OUTPUT);
}

// the loop function runs over and over again forever
void loop() {
     digitalWrite(2, HIGH);   // turn the LED on (HIGH is the voltage level)
     delay(500);              // wait for a second
     digitalWrite(2, LOW);    // turn the LED off by making the voltage LOW
     delay(500);              // wait for a second
}






If you want to use it without RESET + PROG buttons control, then just solder the back jumpers as in the picture below and No manual reset needed , no buttons to press, just press Upload in Arduino IDE and that's it!







Tuesday, November 17, 2015

New ESP8266 DevBoard - CBDB nEXT EVO!


--------------------------------------------------------------------------------------------------------------------------
For any new CBDB orders/requests please feel free to use as usual:
     tech at esp8266-projects.com.


CBDB nEXT Evo bare PCB has also been made available directly at Dirty PCBs, our preferred PCB House for experimenting (**):
 http://dirtypcbs.com/view.php?share=9699&accesskey=91d782fd4a10943fd36ecc371c7ff2cd


(**) - Actually you have there 2 Boards for the price of one, a CBDB nEXT Evo together with a secondary nEXT Extesion Board that brings you a 18Bit ADC (autoscale 0-40V input!), 4x12Bit DAC, Precison Temperature measurement, 8bit I/O port, etc. But more about this one in the next articles. 
-------------------------------------------------------------------------------------------------------------------------


   This simple ESP8266 Board is the result of searching for a smaller and somehow a  more flexibile hardware configuration than the previous CBDB Evolution DevBoard
CBDB v2 Evo is perfect for it's Development (like the Battery Monitor System for example) and Educational purposes, you have there all-in-one-board, ADC, DAC, Voltage, Temperature and Current measurement, RTC, LCD Display, buttons, everything. 
 
   BUT sometime you want to keep is as simple as possible. Just a core. A small one. And you don't want a external/separate USB adapter. And you want to be able to extend the Board capabilities easy with other functions, as you wish and when you wish.

If this is the case then maybe the answer can be found below.



Let's see what we need for a simple ESP8266 Board:
- ESP8266 Module 
- USB adapter
- Voltage regulator
- Extension interface


ESP8266 Module 

   Just pick one from your preffered Shop, Ebay, Banggood,Amazon, etc. Ones of the best offers that I find so far (and with modules that were working OK):

 - 5pcs x ESP07 - 14.30
 - 10pcs x ESP12 - 26.99USD



ESP8266 - CBDB nEXT EVO Core


USB adapter

  For USB adapter we will use a CH340G chip. As been in a SOP16 package it is also very easy to solderat home.


CBDB nEXT EVO - USB adapter schematic

Voltage Regulator

Because I want to be able to run the board also from a Li-Ion or Li-Po Battery, for the voltage regulator decided to use something with better specifications than the usual LD1117. 

The choosen one was MCP1825S . I've use it before in many other projects and it's very good LDO: 
-  Input Operating Voltage Range: 2.1V to 6.0V
- 500 mA Output Current Capability
-  Low Dropout Voltage: 210 mV Typical at 500 mA ! - > you have about 1V for LD1117 !
- Low Supply Current: 120 μA

CBDB nEXT EVO - Voltage Regulator

 Extension interface

     The choosen nExtensions Bus Interface that will be used for connecting the ESP8266 Main Board with the other compabile available modules is very simple one, based on the I2C standard interface.  

    In the same time, you have full access to all the pins thru JP1 and JP2 pin headers. You can even use this headers to directly connect the CBDB nEXT Board to a Breadboard as they are at a breadboard friendly distance!


Putting together all the bits and pieces, this is the final result: 


CBDB nEXT EVO 3.4d Schematic



the PCB for it: 
 
CBDB nEXT Evo v3.4d PCB

  and the final result: 

CBDB nEXT Evo v3.4d Board
 
  Next we will continue with Firmware upload and some basic tests. 

Wednesday, November 4, 2015

Raspberry PI2 + Thingspeak on JESSIE


   This is a follow-up for the previous Raspberry PI2 - Standalone Thingspeak server installation

   Because many people have encountered lots of issues with the installation, mainly r8188eu WIFI chipset driver issues or strange compile problems, I was thinking to give a chance also to the new RASPBIAN Jessie, maybe it might be possible to make life easier for many of us.

   The setup environment remain the same, same remain the SD Card flashing process, so please take a look first at : Raspberry PI2 - Standalone Thingspeak server installation

   First thing: because I use RPI2 board headless, I have disabled the new default boot to graphical interface that Jessie has, CLI is more than enough for me.


   GOOD NEWS!! The issue with the r8188eu WIFI seems to be solved. At least my dongle worked this time out of the box, nothing fancy to be done anymore.



   Below is the full transcript of a Thingspeak Server installation process finished about 30 min ago, using a fresh new RASPBIAN Jessie image:


System Update & required packages install

  • Switched over to SSH remote access with Putty - accept new key
  • Change "pi" account password:
                  pi@RPIMON1~$passwd
  • Set ROOT password, so you can then use root (just for very, very special things!)
              pi@RPIMON1~$sudo passwd root
  • System Update & upgrade  :
              pi@RPIMON1~$sudo apt-get update            
              pi@RPIMON1~$sudo apt-get upgrade          
              pi@RPIMON1~$sudo apt-get dist-upgrade   
              pi@RPIMON1~$sudo sync

  • Reboot:
            pi@RPIMON1~$ sudo reboot
  • INSTALL Required packages:
           pi@RPIMON1~$sudo apt-get -y install build-essential git mysql-server mysql-client 
                                       libmysqlclient-dev libxml2-dev libxslt-dev libssl-dev libsqlite3-dev  

 MySQL Database configuration

    pi@RPIMON1~$mysql --user=root mysql -p useyourpasswd here
    pi@RPIMON1~$mysql> CREATE USER 'thing'@'localhost' IDENTIFIED BY 'speak’;
    pi@RPIMON1~$mysql> GRANT ALL PRIVILEGES ON *.* TO 'thing'@'localhost' WITH GRANT OPTION;
    pi@RPIMON1~$mysql> commit;
    pi@RPIMON1~$mysql> exit;


Ruby / Rails install

          pi@RPIMON1~$wget http://cache.ruby-lang.org/pub/ruby/2.1/ruby-2.1.5.tar.gz
          pi@RPIMON1~$tar xvzf ruby-2.1.5.tar.gz
          pi@RPIMON1~$cd ruby-2.1.5
          pi@RPIMON1~$./configure
          pi@RPIMON1~$make


MAKE RESULT:

  Files:        962
  Classes:     1414 ( 566 undocumented)
  Modules:      268 (  87 undocumented)
  Constants:   2098 ( 624 undocumented)
  Attributes:  1146 ( 272 undocumented)
  Methods:    10651 (2228 undocumented)

  Total:      15577 (3777 undocumented)
   75.75% documented

  Elapsed: 812.6s
 

(That means you need to be VERY patient thru the entire process ! :) )


          pi@RPIMON1~$sudo make install
          pi@RPIMON1~$cd ..
          pi@RPIMON1~$echo "gem: --no-rdoc --no-ri" >> ${HOME}/.gemrc
          pi@RPIMON1~$sudo gem install rails
 



THINGSPEAK SERVER INSTALL

    pi@RPIMON1~$git clone https://github.com/iobridge/thingspeak.git
    pi@RPIMON1~$cp thingspeak/config/database.yml.example thingspeak/config/database.yml
    pi@RPIMON1~$cd thingspeak
    pi@RPIMON1~$bundle install
    pi@RPIMON1~$bundle exec rake db:create

   
Check MYSQL DB:

    pi@RPIMON1~$mysql --user=root mysql -p
    pi@RPIMON1~$mysql> show databases;

#+----------------------------  +
#| Database                        |
#+----------------------------  +
#| information_schema        |
#| mysql                              |
#| performance_schema      |
#| thingspeak_development |
#| thingspeak_test               |
#+------------------------------+


     pi@RPIMON1~$mysql> exit; 

IF MYSQL DB OK  then :

     pi@RPIMON1~$bundle exec rake db:schema:load





 RUN the THINGSPEAK SERVER:

    pi@RPIMON1 ~/yourthingspeak $ rails server webrick.




 That's it! Prepare yourself for about 4 hours of patience :)

 Waiting your feedback about!